HELP: schema validation error

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 UTC