W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2006

Re: Ignore Order while validating XSD

From: <noah_mendelsohn@us.ibm.com>
Date: Wed, 22 Feb 2006 15:10:28 -0500
To: "Ramkumar Menon" <ramkumar.menon@gmail.com>
Cc: "Mukul Gandhi" <gandhi.mukul@gmail.com>, "Ralf Lammel" <Ralf.Lammel@microsoft.com>, xmlschema-dev@w3.org
Message-ID: <OF9BFA6614.DB303E1B-ON8525711D.006E76A9-8525711D.006ED2BF@lotus.com>

Ramakumar Menon asks:

> Apart from being a best practice, cd somebody tell me atleast five 
advantages of enforcing order of elements within an XSD.

Sure.  XML is intended for document scenarios as well as data.  Consider:

<element name="chapter">
        <sequence>
                <element ref="chapterHeading"/>
                <element ref="paragraph" maxOccurs="unbounded"/>
                <element ref="chapterFootnotes"/>
        </sequence>
</element>

It may be very important, or at least semantically significant, that the 
chapterHeading comes ahead of the paragraphs, and that the 
chapterFootnotes follow.  Furthermore, it's clearly important that the XML 
Infoset guarantees that the order of the paragraphs is preserved, if there 
is more than one paragraph.

Keep in mind that XML Schema is made for documents and data together, and 
that is part of its power.  That may seem like excess complexity if you're 
just defining lists of part numbers, but then you may one day find that 
you want to include XHTML descriptions for those parts, and suddenly the 
fact that order is significant starts to make sense.

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------
Received on Wednesday, 22 February 2006 20:10:47 GMT

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