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] Attribute Order (Was: Create XML )

[ Lists Home | Date Index | Thread Index ]

Andrew Watt wrote:
[[
In a message dated 22/06/2003 02:17:06 GMT Daylight Time,
simonstl@simonstl.com writes:


I don't mind given machines access to information in forms that are
easier for them - I just mind that information is lost in any round trip
through that giving of access and then back to XML.

Ditto for attribute order.


Thinking back to XML 1.0, why is it that attributes are not ordered?

It seems incongruous given that attributes are declared by an attribute list
declaration, implying ordering of attributes. I appreciate that Chapter 3 of
XML 1.0 (1st Edition) refers to a "set" of attribute specifications.
]]

If you want to preserve attribute order, as well as whether an attribute
value is single or double quoted, you need to use special software. Nothing
prevents you from doing so, for example Notepad :-), but nonetheless, when
the community coalesced around SAX, for example, the community decided that
the benefits of preserving attribute order did not justify implementation in
SAX. The XML Infoset was a post hoc specification that codified the behavior
of such APIs as SAX, as well as XPath etc.

So the reason that most XML software is not designed to preserve attribute
order is that the _intention_ of attributes was to serve as name-value
pairs, and to be easily implemented via a hashtable. When serialized,
hashtables are ordered, but the order is not intended to be significant,
ditto XML attributes.

Now there is nothing that _prevents_ your software from preserving attribute
order, but if you use such software you will loose the reuse of other
software written to preserve what is specified in the XML Infoset.

Jonathan





 

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

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