W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2007

Re: Attributes ordering

From: Pete Cordell <petexmldev@tech-know-ware.com>
Date: Thu, 22 Mar 2007 17:57:45 -0000
Message-ID: <002401c76cab$9c9a8c10$c900a8c0@Codalogic>
To: "Nataraj Ramalingam" <Nataraj.Ramalingam@aricent.com>
Cc: <xmlschema-dev@w3.org>

Original Message From: "Nataraj Ramalingam" <Nataraj.Ramalingam@...>

>. I have one more doubt w.r.t ordering of elements.
> consider the following example.
> =====================================================
> <xs:complexType name="test">
>        <xs:sequence>
>                <xs:element name="a" type="xs:string"/>
>                <xs:element name="b" type="xs:string" minOccurs="0"/>
>                <xs:element name="c" type="xs:string"/>
>        </xs:sequence>
> </xs:complexType>
>
> <xs:element name="test" type="test"/>
> =====================================================
>
> Eventhough we use a sequence type here, does this mandate the order of
> elements in the instance to be only a,b,c.
> Or, since "b" is optional ( minOccurs=0 ), can it (should it, by any means
> )come after "c" in the instance? for example, can the ordering be a,c,b?


As it's a sequence, if b is present, then it must appear between a and c 
(i.e. the same order as specified in the definition).  (so a, b, c or just 
a, c.)

The xs:all construct for the order to be changed, but there are currently 
numerous restrictions on that.

HTH,

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx/
http://www.codalogic.com/lmx/
=============================================
Received on Thursday, 22 March 2007 17:58:07 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:12 UTC