W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2002

HELP: schema validation error

From: <ajerbi@mmm.com>
Date: Wed, 7 Aug 2002 10:20:49 -0400 (EDT)
To: xmlschema-dev@w3.org
Message-ID: <OF2333BF79.8264B783-ON86256C0E.004C8B9F@mmm.com>




I use the following parser to parse my XML data:
org.apache.xerces.parsers.SAXParser
Here is the schema I am using:
<!--
     Define the Request element
  -->
  <xs:element name="request">
     <xs:complexType>
       <xs:sequence>
          <xs:group ref="requestGroup"/>
          <xs:element ref="field" minOccurs="0" maxOccurs="unbounded"/>
       </xs:sequence>
     </xs:complexType>
  </xs:element>
  <!--
     Define the request group
  -->
  <xs:group name="requestGroup">
     <xs:all>
       <xs:element name="facilityName" type="xs:string"/>
       <xs:element name="printerName" type="xs:string" />
       <xs:element name="copies" type="xs:positiveInteger" default="1"/>

     </xs:all>
  </xs:group>
  <!--
     Define the Field element
  -->
  <xs:element name="field">
     <xs:complexType>
       <xs:attribute name="name" type="xs:string" use="required"/>
       <xs:attribute name="value" type="xs:string" use="required"/>
     </xs:complexType>
  </xs:element>


Here is the error message I get when I parse an xml file that uses the
above schema with the following parser: org.apache.xerces.parsers.SAXParser
Error:  cos-all-limited.1.2: A group whose content is "all" must only
appear as the content type of a complex type definition.  Saw group in
"sequence".
I don't get this error when I use a different parser.

My goal is to write a schema that will allow the 'request' element to have
the first three elements ('facilityName','printerName','copies') in any
order possible followed by any number of 'field' elements.

Is it possible to write such a schema? I would appreciate any help. Thank
you!

Akram
Received on Thursday, 8 August 2002 05:40:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:34 GMT