Skip to content

XML\RNG Validation Wierdness #1688

@feamsr00

Description

@feamsr00

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:
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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions