Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: unordered sequence

From: "Pete Cordell" <petexmldev@---------.--->
To: "Richard Markus" <ricccmarkus@-----.--->, <xmlschema-dev@--.--->
Date: 11/9/2008 2:20:00 PM
----- Original Message From: "Richard Markus"

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

Paradoxically, when order doesn't matter the recommendation is to use 
<xs:sequence>, which does impose an order.  The theory is roughly if the 
order doesn't matter, then it won't matter if an order is imposed!

So with XSD 1.0 what you have presented below is as close as you can get to 
what you want.

In the new version of XML schema (1.1) that is coming up, the restriction on 
<xs:all> only allowing a maxOccurs of 1 (or less) will be removed and you 
will be able to do exactly what you want.  But editing work on XSD 1.1 is 
still in progress so most people won't want to hold up their development 
until its available.

HTH,

Pete Cordell
Codalogic Ltd
Interface XML to C++ the easy way using XML C++
data binding to convert XSD schemas to C++ classes.
Visit http://www.codalogic.com/lmx/ for more info

----- Original Message ----- 
From: "Richard Markus" <ricccmarkus@g...>
To: <xmlschema-dev@w...>
Sent: Friday, November 07, 2008 3:53 PM
Subject: unordered sequence


>
>
> 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--
>
>
> 





transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent