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 29187] New: - xmlvalidate schema validation not working
Date Mon, 24 May 2004 20:51:44 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=29187>.
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=29187

xmlvalidate schema validation not working

           Summary: xmlvalidate schema validation not working
           Product: Ant
           Version: 1.6.1
          Platform: PC
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: lubell@nist.gov


I cannot get xmlvalidate to perform schema validation using the Xerces parser
included with Ant.

My build file, XML document, schema, and Ant build results are as follows:

*** build.xml ***

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

  <description>$Date: 2004/05/24 19:43:26 $</description>

  <target name="validate">
    <xmlvalidate file="personal-schema.xml">
      <attribute name="http://xml.org/sax/features/validation" value="true"/>
      <attribute 
        name="http://apache.org/xml/features/validation/schema" value="true"/>
    </xmlvalidate>
  </target>

</project>


*** personal-schema.xml ***

<?xml version="1.0" encoding="UTF-8"?>
<personnel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	   xsi:noNamespaceSchemaLocation='personal.xsd'>

  <person id="Big.Boss" >
    <name><family>Boss</family> <given>Big</given></name>
    <email>chief@foo.com</email>
    <link subordinates="one.worker two.worker three.worker four.worker
five.worker"/>
  </person>

  <person id="one.worker">
    <name><family>Worker</family> <given>One</given></name>
    <email>one@foo.com</email>
    <link manager="Big.Boss"/>
  </person>

  <person id="two.worker">
    <name><family>Worker</family> <given>Two</given></name>
    <email>two@foo.com</email>
    <link manager="Big.Boss"/>
  </person>

  <person id="three.worker">
    <name><family>Worker</family> <given>Three</given></name>
    <email>three@foo.com</email>
    <link manager="Big.Boss"/>
  </person>

  <person id="four.worker">
    <name><family>Worker</family> <given>Four</given></name>
    <email>four@foo.com</email>
    <link manager="Big.Boss"/>
  </person>

  <person id="five.worker">
    <name><family>Worker</family> <given>Five</given></name>
    <email>five@foo.com</email>
    <link manager="Big.Boss"/>
  </person>

</personnel>


*** personal.xsd ***

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>

 <xs:element name="personnel">
  <xs:complexType>
   <xs:sequence>
     <xs:element ref="person" minOccurs='1' maxOccurs='unbounded'/>
   </xs:sequence>
  </xs:complexType>

  <xs:unique name="unique1">
   <xs:selector xpath="person"/>
   <xs:field xpath="name/given"/>
   <xs:field xpath="name/family"/>
  </xs:unique>
  <xs:key name='empid'>
   <xs:selector xpath="person"/>
   <xs:field xpath="@id"/>
  </xs:key>
  <xs:keyref name="keyref1" refer='empid'>
   <xs:selector xpath="person"/> 
   <xs:field xpath="link/@manager"/>  
  </xs:keyref>

 </xs:element>

 <xs:element name="person">
  <xs:complexType>
   <xs:sequence>
     <xs:element ref="name"/>
     <xs:element ref="email" minOccurs='0' maxOccurs='unbounded'/>
     <xs:element ref="url"   minOccurs='0' maxOccurs='unbounded'/>
     <xs:element ref="link"  minOccurs='0' maxOccurs='1'/>
   </xs:sequence>
   <xs:attribute name="id"  type="xs:ID" use='required'/>
   <xs:attribute name="note" type="xs:string"/>
   <xs:attribute name="contr" default="false">
    <xs:simpleType>
     <xs:restriction base = "xs:string">
       <xs:enumeration value="true"/>
       <xs:enumeration value="false"/>
     </xs:restriction>
    </xs:simpleType>
   </xs:attribute>
   <xs:attribute name="salary" type="xs:integer"/>
  </xs:complexType>
 </xs:element>

 <xs:element name="name">
  <xs:complexType>
   <xs:all>
    <xs:element ref="family"/>
    <xs:element ref="given"/>
   </xs:all>
  </xs:complexType>
 </xs:element>

 <xs:element name="family" type='xs:string'/>

 <xs:element name="given" type='xs:string'/>

 <xs:element name="email" type='xs:string'/>

 <xs:element name="url">
  <xs:complexType>
   <xs:attribute name="href" type="xs:string" default="http://"/>
  </xs:complexType>
 </xs:element>

 <xs:element name="link">
  <xs:complexType>
   <xs:attribute name="manager" type="xs:IDREF"/>
   <xs:attribute name="subordinates" type="xs:IDREFS"/>
  </xs:complexType>
 </xs:element>

 <xs:notation name='gif' public='-//APP/Photoshop/4.0' system='photoshop.exe'/>

</xs:schema>


*** Ant build results ***

ant
Buildfile: build.xml

validate:
[xmlvalidate] /E:/xerces/data/personal-schema.xml:3:50: cvc-elt.1: Cannot find
the declaration of element 'personnel'.

BUILD FAILED
E:\xerces\data\build.xml:6: E:\xerces\data\personal-schema.xml is not a valid
XML document.

Total time: 0 seconds

Compilation exited abnormally with code 1 at Mon May 24 16:41:00

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


Mime
View raw message