Re: [xml] Ordering of attributes: xmlGetDtdElementDesc()

On Tue, Feb 11, 2003 at 12:06:39PM -0800, Mark S Petrovic wrote:
I believe you mean that the ordering is not significant because there
are many logically equivalent representations of an XML document.
Fair enough.  You are therefore free to tell me that further questions
on this have no meaning.

But ---  being a glutton for punishment, the list, in fact has some
order for a given instance of the thing pointed to by dtdPtr DTD.
Is this order something you might comment on?  If not, I understand.

  Basically, the order generated depends on the internal processing
of the parser. The ways the various declarations have veen assembled
in the DTD (one can have multiple declarations for a given attribute,
and for multiple attribute they can come from an unbounded number of
ATTLIST declarations), and I think ultimately the ordering may ends up
being generated by a linear walk in an hash table and merging on the
element declaration. Which means I really don't want anybody's code
to depends on any such ordering, it is purely implementation dependant
and has no logical sense either at the XML formal level.

  Sorry, you don't have the right to base any algorithm on a perceived
order. Even for a reparse of the exact same document, the order may
change in future versions of the library (e.g. if the default hash
table initial size were to change). If you really want a stable order
you can sort them a posteriori using a lexicographic sort on the 
QName for example.


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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