[Home] [By Thread] [By Date] [Recent Entries]

  • To: <xml-dev@l...>
  • Subject: schema validation question
  • From: "Joe Hallett" <jhallett@m...>
  • Date: Sun, 14 Apr 2002 13:42:24 -0400

I am trying to validate a schema instance doc against the following schema:
 
<schema xmlns="http://www.w3.org/2001/XMLSchema"
 xmlns:fac="http://localhost:8080/xmlp/xs"
        targetNamespace="http://localhost:8080/xmlp/xs">
 
 <annotation>
    <documentation>
    Developed by Joe Hallett at Colgate University.
    Defines fact data to be used by expert system processing.
    All rights reserved.
   </documentation>
 </annotation>
 
 <element name="Facts" type="fac:FactsType"/>
 <complexType name="FactsType">
  <sequence>
   <element name="Fact" type="fac:FactType" maxOccurs="unbounded"/>
  </sequence>
 </complexType>
 <complexType name="FactType">
  <sequence>
   <element name="Name" type="string"/>
   <element name="Value" type="fac:ValueUnion"/>
   <element name="Subfacts" type="fac:FactsType" minOccurs="0" maxOccurs="unbounded"/>
  </sequence>
 </complexType>
 <complexType name="ValueUnion">
  <sequence>
   <element name="String" type="string"/>
   <element name="Int" type="int" maxOccurs="unbounded"/>
   <element name="Float" type="float" maxOccurs="unbounded"/>
   <element name="Long" type="long" maxOccurs="unbounded"/>
   <element name="List" type="fac:ListType" maxOccurs="unbounded"/>
  </sequence>
 </complexType>
 <complexType name="ListType">
  <sequence>
   <element name="Type" type="fac:TypeEnum"/>
   <element name="Element" type="fac:ValueUnion" maxOccurs="unbounded"/>
  </sequence>
 </complexType>
 <simpleType name="TypeEnum">
  <restriction base="string">
   <enumeration value="string"/>
   <enumeration value="int"/>
   <enumeration value="float"/>
   <enumeration value="long"/>
   <enumeration value="list"/>
  </restriction>
 </simpleType>
</schema>
 
 
I am using Xerces 14.4 to parse the doc and have set the "http://apache.org/xml/properties/schema/external-schemaLocation" property to find the above schema.
 
The reason for the localhost:8080 URL is because I am running tomcat 4.0 to access the schema.
 
When I run the validator on the instance doc I receive errors that tell me all the element types, with the exception of the global element "Facts", must be declared.
 
Any idea??
 
Thanks for the help,
 
Joe
 

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member