[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: XML 1.0 - Element order significance
- From: Jonathan Borden <jborden@mediaone.net>
- To: Danny Ayers <danny@panlanka.net>, XML Developers List <xml-dev@xml.org>
- Date: Mon, 22 Jan 2001 15:44:27 -0500
Danny Ayers wrote:
> I read the XML Rec to mean that there's no guarantee of order information
in
> an XML document
Actually in an XML document, sibling elements are *guaranteed* to be
ordered. An XML document is a character stream, and one sibling follows the
other. The question is as to what *processing software* is to do with an XML
document, and you need to look at the particulars of the processing software
to answer that question.
Two types of processors defined by W3C recs are XSLT/XPath and DOM. XPath
clearly preserves element order: e.g given the following document:
<foo>
<bar id="first" />
<bar id="second" />
</foo>
and the XPath's:
/foo/bar[1]/@id = "first"
/foo/bar[2]/@id = "second"
so the XPath model is ordered.
Likewise the DOM: A NodeList is ordered.
SAX (FWIW :-) is also ordered.
...It may be
> possible for applications to read/write additional information through
> order, but this is beyond the scope of the XML Rec.
The XML REC describes a syntax not a processing model -- but in any case
elements in an XML document are ordered -- whether the order is
*significant* is as Henry notes, dependent on the document's grammar.
>
> Having said that, if the document has an infoset, then information in the
> form of element order may be conveyed through this :
>
Right, so as you note, the Infoset preserves order :-))
Jonathan Borden
http://www.openhealth.org