Re: [xml] Ordering of TAGS and data
- From: Stefan Seefeld <seefeld sympatico ca>
- To: xml gnome org
- Subject: Re: [xml] Ordering of TAGS and data
- Date: Mon, 24 Nov 2003 11:49:02 -0500
Paul Robert Hayes wrote:
> When libxml reads the tags and attributes, it
will place them in the tree in the order they occurred in the original XML
data file. The data within each <first> </first> should remain as placed in
the XML file.
No ! That's only true for elements (<element>), but *not* for
attributes. There is no guarantee being made about any ordering of
attributes, Tomorrow's libxml2 release could change the order of the
attributes in its internal representation. You *must not* rely on any
ordering. If you have such a requirement, it's a good sign that you
should use elements instead.
What I am hearing is that I do not need to have the "seq" attribute below on
each data element because the second example should be parse in file order
and thus can be added to a linked list in order. The <data> would always be
listed in first to last order in our examples.
That's right.
On the other hand, if we wanted to allow the <data> elements to be ordered
but randomly entered into the data file, then the "seq" attribute would be
required which could be parsed from libxml as the <data> attribute and then
assigned to the list in the correct order.
yes, any semantics you add above the XML level is up to you.
Regards,
Stefan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]