[
Lists Home |
Date Index |
Thread Index
]
- From: "Paul W. Abrahams" <abrahams@valinet.com>
- Date: Mon, 23 Oct 2000 14:45:10 -0400
Ronald Bourret wrote:
> Eric van der Vlist wrote:
> > 1) Should we always pay attention to the relative order of the elements
> > within XML documents ?
>
> First, I think it is important here to clarify that there are three
> types of order in an XML document: hierarchical order, sibling order,
> and document order.
>
> Hierarchical order determines who is the parent and who is the child. I
> cannot think of any reasonable cases for which hierarchical order is not
> important.
>
> Sibling order is the order in which siblings (elements/text with the
> same parent) appear in that parent. To me, this discussion is about
> sibling order, so more about that in a moment.
>
> Document order is the order in which elements/text appear in the
> document. This is important in some cases (such as XSLT), unimportant in
> others. Note that document order can be determined from hierarchical and
> sibling order, and that if you preserve hierarchical and sibling order
> you preserve document order.
>
> So the question is, is sibling order always important. The answer is,
> absolutely not. Here's the two cases:
>
> In general, sibling order is always important in document-centric
> applications.
> On the other hand, sibling order is often unimportant in data-centric
> applications. The reason for this is that objects have no notion of order
> among their
> properties.
For what it's worth, the XML Infoset lists among the core properties of an
element both its children and its attributes. The children constitute an
ordered list of references, while the attributes constitute an unordered
set. Of course, one could say, as you do, that in particular cases the
ordering of elements, though it exists, has no useful significance; the
elements are in a particular order only because they have to be in *some*
order.
Paul Abrahams
|