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

Re: Attributes ordering

From: <noah_mendelsohn@us.ibm.com>
Date: Thu, 22 Mar 2007 17:03:07 -0300
To: Nataraj Ramalingam <Nataraj.Ramalingam@aricent.com>
Cc: "Pete Cordell" <petexmldev@tech-know-ware.com>, xmlschema-dev@w3.org
Message-ID: <OFA3665DED.0E542578-ON842572A6.006E0F32-842572A6.006E2A99@lotus.com>

Ooops, Pete is right.  I didn't notice that namespace="##other".  That 
makes this schema legal after all.  It means:

* the <a/> must come first
* a <c/> must come last
* any number of additional things from a namespace other than the one 
begin declared by this schema document can come in the middle. 

Sorry, I missed that.

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------








Noah Mendelsohn
03/22/2007 04:00 PM

        To:     Nataraj Ramalingam <Nataraj.Ramalingam@aricent.com>
        cc:     "Pete Cordell" <petexmldev@tech-know-ware.com>, 
xmlschema-dev@w3.org
        Subject:        Re: Attributes ordering


This is trickier.  In schema 1.0, this schema is not legal.  It violates 
what's known as the unique particle attribution constraint.  Reason:  if 
you give it the instance <a/><c/>, you would have to look ahead to realize 

that the <c/> needs to be matched against the element reference and not 
the wildcard.  Schemas with such ambiguities or lookahead requirements are 

illegal in schema 1.0.  Still, I can translate what this schema is trying 
to say:

* the <a/> must come first
* a <c/> must come last
* any number of additional things including <a/>'s and </c>'s can come in 
the middle. 

My point is: order always matters in a sequence the fact that the <any> 
tends to accept lots of different things may appear to obscure that, but 
in the end, sequences are always ordered.

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------








Nataraj Ramalingam <Nataraj.Ramalingam@aricent.com>
Sent by: xmlschema-dev-request@w3.org
03/22/2007 02:48 PM
 
        To:     "Pete Cordell" <petexmldev@tech-know-ware.com>
        cc:     xmlschema-dev@w3.org, (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        Re: Attributes ordering



Does the same hold good, if wildcard is used? 

In the same mentioned example, instead of b, let's assume that a wildcard 
appears. 
========================================================================= 
<xs:complexType name="test">
       <xs:sequence>
               <xs:element name="a" type="xs:string"/>
                   <xs:any namespace="##other" processContents="lax" 
minOccurs="0" maxOccurs="unbounded"/>
               <xs:element name="c" type="xs:string"/>
       </xs:sequence>
</xs:complexType>

<xs:element name="test" type="test"/> 
==================================================================================== 


In this case, can there be instances of following possibilities, 
a,b,c 
a,c,b 
b,a,c 
a,c, b, b          where b is an element of some other namespace. 

I see that in some of the IETF protocols, only whenever wildcard is used, 
the order of elements inside a sequence seems strange. It simply allows 
any possibilities, almost breaking the expected sequence behavior. 
COuld this be clarified? 

Kind Regards, 
Nataraj. 




"Pete Cordell" <petexmldev@tech-know-ware.com> 
Sent by: xmlschema-dev-request@w3.org 
03/22/2007 11:27 PM 


To
Nataraj Ramalingam/CHE/HSS@HSS 
cc
<xmlschema-dev@w3.org> 
Subject
Re: Attributes ordering









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






***********************  Aricent-Private   *********************** 
"DISCLAIMER: This message is proprietary to Aricent and is intended solely 

for the use of 
the individual to whom it is addressed. It may contain privileged or 
confidential information and should not be 
circulated or used for any purpose other than for what it is intended. If 
you have received this message in error, 
please notify the originator immediately. If you are not the intended 
recipient, you are notified that you are strictly
prohibited from using, copying, altering, or disclosing the contents of 
this message. Aricent accepts no responsibility for 
loss or damage arising from the use of the information transmitted by this 

email including damage from virus."
Received on Thursday, 22 March 2007 20:06:13 UTC

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