ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 32791] New: - xmlvalidate task fails with multiple files.
Date Tue, 21 Dec 2004 19:38:48 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32791>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32791

           Summary: xmlvalidate  task fails with multiple files.
           Product: Ant
           Version: 1.6.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: spremi@yahoo.com


I started using xmlvalidate task on v1.6.2 yesterday.

It appears that the task validates the XML file against the specified XSD when
only one file is being validated.

If more that one file is given as input e.g thru <fileset> the task consistently
fails on the second file.

Tried on latest nightly as well.
(I am using lastet JRE available from SUN)

See the errors & sample ANT project below:

====== ERRORS ======
D:\wrk\test\ant>ant
Buildfile: build.xml

val_works:
     [echo] ::: Validate XML file one-by-one
[xmlvalidate] 1 file(s) have been successfully validated.
[xmlvalidate] 1 file(s) have been successfully validated.

val_not_works:
     [echo] ::: Validate XML file(s)
[xmlvalidate] D:\wrk\test\ant\test-2.xml:3:9: cvc-elt.1: Cannot find the
declaration of element 'parent'.

BUILD FAILED
D:\wrk\test\ant\build.xml:93: D:\wrk\test\ant\test-2.xml is not a valid XML
document.

Total time: 0 seconds
D:\wrk\test\ant>

========= build.xml =========

<?xml version="1.0"?>

<project    name    = "test"
            default = "all"
            basedir = ".">

    <target name        = "val_works"
            description = "Validate the XML files against specified XSD.">

        <echo message = "::: Validate XML file one-by-one" />

        <xmlvalidate
            lenient     = "no"
            failonerror = "yes"
            warn        = "yes"
            file        = "test-1.xml">

            <attribute
                name    = "http://xml.org/sax/features/validation"
                value   = "true" />

            <attribute
                name    = "http://apache.org/xml/features/validation/schema"
                value   = "true" />

            <attribute
                name    =
"http://apache.org/xml/features/validation/schema-full-checking"
                value   = "true" />

            <property
                name    =
"http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
                value   = "test.xsd" />

        </xmlvalidate>

        <xmlvalidate
            lenient     = "no"
            failonerror = "yes"
            warn        = "yes"
            file        = "test-2.xml">

            <attribute
                name    = "http://xml.org/sax/features/validation"
                value   = "true" />

            <attribute
                name    = "http://apache.org/xml/features/validation/schema"
                value   = "true" />

            <attribute
                name    =
"http://apache.org/xml/features/validation/schema-full-checking"
                value   = "true" />

            <property
                name    =
"http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
                value   = "test.xsd" />

        </xmlvalidate>

    </target>

    <target name        = "val_not_works"
            description = "Validate the XML files against specified XSD.">

        <echo message = "::: Validate XML file(s)" />

        <xmlvalidate
            lenient     = "no"
            failonerror = "yes"
            warn        = "yes">

            <attribute
                name    = "http://xml.org/sax/features/validation"
                value   = "true" />

            <attribute
                name    = "http://apache.org/xml/features/validation/schema"
                value   = "true" />

            <attribute
                name    =
"http://apache.org/xml/features/validation/schema-full-checking"
                value   = "true" />

            <property
                name    =
"http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
                value   = "test.xsd" />

            <fileset
                dir         = "${basedir}"
                includes    = "test-*.xml" />

        </xmlvalidate>

    </target>

    <target name    = "all"
            depends = "val_works, val_not_works">

    </target>

</project>

========= test.xsd =========
<?xml version = "1.0" encoding = "UTF-8" standalone = "yes" ?>

<xsd:schema
    xmlns:xsd           = "http://www.w3.org/2001/XMLSchema"
    elementFormDefault  = "qualified">

    <xsd:element
        name    = "parent"
        type    = "Parent" />


    <xsd:complexType
        name    = "Parent">

        <xsd:sequence>
            <xsd:element
                name        = "child"
                type        = "xsd:string"
                minOccurs   = "0"
                maxOccurs   = "unbounded" />
        </xsd:sequence>

    </xsd:complexType>



</xsd:schema>

========= test-1.xml =========
<?xml version="1.0" encoding="utf-8"?>

<parent>
    <child>a</child>
    <child>b</child>
    <child>c</child>
    <child>d</child>
</parent>

========= test-2.xml =========
<?xml version="1.0" encoding="utf-8"?>

<parent>
    <child>e</child>
    <child>f</child>
    <child>g</child>
    <child>h</child>
</parent>

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message