Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML\RNG Validation Wierdness #1688

Closed
feamsr00 opened this issue Dec 29, 2022 · 2 comments
Closed

XML\RNG Validation Wierdness #1688

feamsr00 opened this issue Dec 29, 2022 · 2 comments
Milestone

Comments

@feamsr00
Copy link
Contributor

feamsr00 commented Dec 29, 2022

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.github.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:
image
element "target" incomplete; missing required element "selector"

Additionally complains about passthrough attribute. Surely this should be a boolean OR a string, yes?
image
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?

@mrook
Copy link
Member

mrook commented Jan 4, 2023

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}).

@feamsr00
Copy link
Contributor Author

feamsr00 commented Jan 7, 2023

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?

@mrook mrook closed this as completed in 3089d02 Jan 15, 2023
@mrook mrook added this to the 3.0.0-RC4 milestone Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants