RE: [xml] Ordering of TAGS and data

Please pardon the libxml list discussion, because I felt that the library
kept things ordered as they were ordered in the file.  This makes sense to
me and from a parsing standpoint.  I wanted to be certain I understood the
underlying design of the library and the XML fundamentals it was designed to

I see your point of the <second> and <first> tags below as well as Staffan's
comments on the attribute ordering or lack thereof.  I understand this to
mean that the file may come to the libxml interface with sections and
attributes in random order.  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.

This is good because it means I should be able to validate that a <first>
and <second> sections have been filled with data once the <tuple> has ended
via the </tuple>.  At that point, it does not matter which order the <first>
and <second> sections of data have been entered, only that they have been
parsed correctly and that any data they reference were defined previously in
the file.

This should allow the use of libxml to parse the entire document creating
the tree and then traverse the tree "in order" partially filling out data
structures along the way, close off the libxml library and then finally
traverse the linked list data structures to back fill the links.

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.

<data seq="1"> xxxxx  xxxxx  xxxxx  xxxxx </data>
<data seq="2"> xxxxx  xxxxx  xxxxx  xxxxx </data>
<data seq="3"> xxxxx  xxxxx  xxxxx  xxxxx </data>
<data seq="4"> xxxxx  xxxxx  xxxxx  xxxxx </data>

<data> xxxxx  xxxxx  xxxxx  xxxxx </data>
<data> xxxxx  xxxxx  xxxxx  xxxxx </data>
<data> xxxxx  xxxxx  xxxxx  xxxxx </data>
<data> xxxxx  xxxxx  xxxxx  xxxxx </data>

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.

Please pardon my confusion, your expertise with XML and libxml has been most


Dr. Paul Robert Hayes
paulroberthayes earthlink net

-----Original Message-----
From: xml-admin gnome org [mailto:xml-admin gnome org]On Behalf Of Morus
Sent: Monday, November 24, 2003 10:48 AM
To: xml gnome org
Subject: Re: [xml] Ordering of TAGS and data

Paul Robert Hayes writes:
There has been discussion here of ordering of tags and data within an XML
file.  From what I have seen, the TAGS (beginning and ending <> sections)
appear to be ordered when read through Internet Explorer and Konqueror as
well as libxml.  Several people have noted that there is no guarantee of
ordering, though.  To me this does not make sense from a parsing
because the data within a <> section was created by the user and shouldn't
be reordered by the viewer.  Does this stir anyone's memory of XML

Of course it is ordered.

Wouldn't be helpfull, if an document consisting of a number of p (HTML) or
para (docbook) elements, could be randomly reodered ;-)

OTOH it depends on the definition of an xml application, to what extend
order is meaningfull and defined.
Eg. the xml serialisiation of a set of number tuples might look like
where neither the order of the first, second subelement is defined by
the application (that is, you must be able to process any order) nor
the order of the tuples has any meaning.

But for a given xml instance the order is always the same as in the textual

I don't think that this is related to libxml though.
xml mailing list, project page
xml gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]