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

http://www.topologi.com/public/Schtrn_XSD

From: Eddie Robertsson <erobertsson@allette.com.au>
Date: Wed, 12 Jun 2002 10:18:55 +1000
Message-ID: <3D06936F.82DFA6DC@allette.com.au>
To: Torsten Curdt <tcurdt@dff.st>
CC: xmlschema-dev@w3.org

Hi Torsten,

> I am trying to have a mixture of ordered and unordered elements:
>
> <root>
>   <seq1/>
>   <seq2/>
>   <unordered2/>
>   <unordered1/>
> </root>
>
> So what IMHO would make sense would be:
>
>   <xs:element name="root">
>     <xs:complexType>
>       <xs:sequence>
>         <xs:sequence>
>           <xs:element name="seq1"/>
>           <xs:element name="seq2"/>
>         </xs:sequence>
>         <xs:all>
>           <xs:element name="unordered1"/>
>           <xs:element name="unordered2"/>
>         </xs:all>
>       </xs:sequence>
>     </xs:complexType>
>   </xs:element>
> </xs:schema>
>
> But obviously this does not work.
> What is the proposed way to express such a schema?

How about wrapping the unordered content in an extra element:

<root>
  <seq1/>
  <seq2/>
  <unordered>
    <unordered2/>
    <unordered1/>
  </unordered>
</root>

  <xs:element name="root">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="seq1"/>
        <xs:element name="seq2"/>
        <xs:element name="unordered">
          <xs:complexType>
            <xs:all>
              <xs:element name="unordered1"/>
              <xs:element name="unordered2"/>
            </xs:all>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

If this doesn't work (or the suggestion by Mark) you have to move to
RELAX-NG which can define this without problem or use embedded
Schematron rules in your W3C XML Schema (see [1])

Cheers,
/Eddie

[1] http://www.topologi.com/public/Schtrn_XSD/Paper.html


>
>
> Any help appreciated!
> --
> Torsten
Received on Tuesday, 11 June 2002 20:06:07 GMT

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