W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2008

unordered sequence

From: Richard Markus <ricccmarkus@gmail.com>
Date: Fri, 7 Nov 2008 17:53:45 +0200
Message-ID: <d96724c80811070753x5a1b2f0bs331d36291f5bbe08@mail.gmail.com>
To: xmlschema-dev@w3.org

Hi,

I have a question regarding compositors. I didn't find a way to create
a schema definition for the following case.
<doc>
  <a/>
  <b/>
  <c/>
  <c/>
  <d/>
  <e/>
</doc>
I'd like to create a schema, that requires the "a" and "b" elements,
some interval for "c" element, and some other interval for "d" and
"e". The order is not important.

The sequence would be good, but the order doesn't matter, and the
sequence has a restriction for the order of the elements.

Using sequence the schema would be something like this:
<xs:element name="doc">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="a" minOccurs="1" maxOccurs="1" type="xs:string"/>
      <xs:element name="b" minOccurs="1" maxOccurs="1" type="xs:string"/>
      <xs:element name="c" minOccurs="2" maxOccurs="4" type="xs:string"/>
      <xs:element name="d" minOccurs="0" maxOccurs="1" type="xs:string"/>
      <xs:element name="e" minOccurs="0" maxOccurs="1" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

The "all" is also not suitable, because the "maxOccus" is limited to 1.
The "choice" is not good, because I cannot verify, that the correct
number of elements.

Is there any way to describe this structure with schema?

Thanks in advance
--Richard--
Received on Saturday, 8 November 2008 07:36:39 GMT

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