W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2010

Need something like xs:sequence without order?

From: Felix Nensa <nensa@zeec.biz>
Date: Thu, 28 Jan 2010 18:04:19 +0100
Message-ID: <b06e2691001280904r2a3e74ecg209e8a0d6c98bdab@mail.gmail.com>
To: xmlschema-dev@w3.org
Hi experts,

I have some tricky XML that needs to be validated against an XSD, that I am
not sure how to define.
The XML could come in several variations. Some examples:

Example 1:

<SomeElement>
  <A>aaa</A>
  <B>bbb</B>
  <C>ccc</C>
  <D>ddd</D>
  <D>dde</D>
</SomeElement>

Example 2:

<SomeElement>
  <B>bbb</B>
  <A>aaa</A>
  <C>ccc</C>
  <D>ddd</D>
  <D>dde</D>
</SomeElement>

Example 3:

<SomeElement>
  <B>bbb</B>
  <A>aaa</A>
  <D>ddd</D>
  <D>dde</D>
</SomeElement>


The corresponding XSD that I would like to define (but of course is invalid)
would look like this:

<xs:element name="SomeElement">
  <xs:complexType>
    <xs:all>
     <xs:element name="A" type="xs:string" minOccurs="1" maxOccurs="1" />
     <xs:element name="B" type="xs:string" minOccurs="1" maxOccurs="1" />
     <xs:element name="C" type="xs:string" minOccurs="0" maxOccurs="1" />

     <xs:element name="D" type="xs:string" minOccurs="1"
maxOccurs="unbounded" />

    </xs:all>
  </xs:complexType>
</xs:element>

Any ideas how to achive the same with valid XSD?
Thanks in advance,

Felix
Received on Thursday, 28 January 2010 21:35:55 GMT

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