xml schema putting both sequence and all under one complexType node

Posted by exiang on Stack Overflow See other posts from Stack Overflow or by exiang
Published on 2010-03-09T10:02:13Z Indexed on 2010/03/09 10:06 UTC
Read the original article Hit count: 250

Filed under:
|

Here is the xml file:

<section>
    <number>1</number>
    <title>A Title goes here...</title>
    <code>TheCode</code>

    <element></element>
    <element></element>
</section>

In section node, there are number, title and code node. Their sequence must not be fixed. Then, there are multiple element under section node as well.

The idea is to use the following schema:

<xs:complexType name="Type-section">

  <xs:all>
    <xs:element name="number" minOccurs="0"></xs:element>
    <xs:element name="code"  minOccurs="1"></xs:element>
    <xs:element name="title"  minOccurs="1"></xs:element>
  </xs:all>

  <xs:sequence>
    <xs:element maxOccurs="unbounded" name="element"></xs:element>
  </xs:sequence>
</xs:complexType>

But it is invalid. I just cant put "sequence" and "all" together in the same level. How can i fix it?

© Stack Overflow or respective owner

Related posts about Xml

Related posts about schema