[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Can XML Schemas do this?


xml schema attribute order
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
elements"/>

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
"interleave". 

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. 

</extract>

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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.