XML\RNG Validation Wierdness
feamsr00 opened this issue · 2 comments
Describe the bug
When validating the build.xml file with the relaxng schema it insists that "selector" is missing in the <project>
root tag and all <target>
tags.
Steps To Reproduce
Add the rng file as a schema definition to the top of the file.
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://raw.githubusercontent.com/phingofficial/phing/3.0.0-RC3/etc/phing-grammar.rng"
type="application/xml"
schematypens="http://relaxng.org/ns/structure/1.0" ?>
Expected behavior
Smooth error correction and autocomplete bliss.
Screenshots / terminal output
"selector" element demands:
element "target" incomplete; missing required element "selector"
Additionally complains about passthrough
attribute. Surely this should be a boolean OR a string, yes?
value of attribute "passthru" is invalid; must be a boolean
Additional context
I think this is caused by these lines in the phing-grammar.rng file.
<define name="project">
<element name="project">
<interleave>
<attribute name="name"/>
<optional>
<attribute name="basedir"/>
</optional>
<attribute name="default"/>
<optional>
<attribute name="description"/>
</optional>
<optional>
<attribute name="phingVersion"/>
</optional>
<optional>
<attribute name="strict"/>
</optional>
</interleave>
<interleave>
<zeroOrMore>
<ref name="target"/>
</zeroOrMore>
<zeroOrMore>
<ref name="extension-point"/>
</zeroOrMore>
<ref name="coretasks"/>
<ref name="optionaltasks"/>
<ref name="coretypes"/>
#L72 <ref name="selector"/>
</interleave>
</element>
</define>
<!--
===========================================================================================================
Target element.
===========================================================================================================
-->
<define name="target">
<element name="target">
<!-- Attributes for target element -->
<interleave>
<attribute name="name"/>
<optional>
<attribute name="depends"/>
</optional>
<optional>
<attribute name="hidden"/>
</optional>
<optional>
<attribute name="if"/>
</optional>
<optional>
<attribute name="unless"/>
</optional>
<optional>
<attribute name="description"/>
</optional>
<optional>
<attribute name="logskipped"/>
</optional>
</interleave>
<interleave>
<ref name="coretasks"/>
<ref name="coretypes"/>
<ref name="optionaltasks"/>
#L321 <ref name="selector"/>
</interleave>
</element>
</define>
Maybe those selectors are supposed to be wrapped in the optional
tags?
Hi @feamsr00. You could be very right. IntelliJ's RNG support is not great, so it's very possible things are less than optimal. What editor are you using?
passthru
is supposed to be a boolean, looks like your editor is tripping over the variable expansion (${build.isVerbose}
).
I'm using VS Codium (VS Code clode) 1.74.2 with Redhat's XML extension
Heh. I will grant that property file variable expansion might be a lot to ask from xml editing. Moreover, asking every attribute to allow a string type as well might also be a bridge too far, yes?