OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   RE: [xml-dev] Can XML Schemas do this?

[ Lists Home | Date Index | Thread Index ]

On Mon, 2003-01-20 at 23:06, Jeff Lowery wrote:

> There was an excellent thread on this last week.  Basically, the argument
> goes: 
> a) if order doesn't matter, choose one (because it doesn't matter!)
> b) if order does matter, declare the correct order

Coincidence, I have written a section about this issue in my (to be
published soon) book on Relax NG no later than a couple of hours ago
taking an exact opposite position:

<extract title="Be liberal on the relative order between children

Together with confusing the usage of elements and attributes, another
bad habit taken during our few years of XML experience is the assumption
that schemas should always enforce a fixed order between children
elements or in other words that relative order between sub elements
always matters. 

This relative order is much less natural than we use to think. To draw a
parallel with another technology, it's considered a bad practice to pay
attention to the physical order of columns and rows in the table of a
relational database. Furthermore, the dominant modeling methodology,
UML, does not attach any order to the attributes of class (note that UML
attributes are often used to represent not only XML attributes but also
elements) and does not attach any order to relations between classes
(unless specifically specified). 

In fact, the main reasons behind this principle are limitations from
DTDs and more recently from W3C XML Schema but there are strong reasons
to believe that on the contrary when there is no special reasons,
relative order between sub elements is a serialization detail and that
we shouldn't bother users and applications with the unecessary
constraint of enforcing it. 

With Relax NG, defining content models where the relative order between
children elements is not significant is not only almost as simple as
defining content models where it is significant (it's just a matter of
adding "interleave" elements) but it is also more extensible since these
content models can easily be extended through pattern combinations by

Using them wherever it is possible is thus a way to put ourselves in a
position where new elements and attributes can be added as shown in our
example about the addition of the "id" attribute in the "library"
element in the first sections of this chapter. 


Curious about Relax NG? My book in progress is waiting for your review!
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS