[XML-SIG] SAX Namespaces

tpassin@home.com tpassin@home.com
Thu, 6 Jul 2000 22:00:00 -0400


Fred L. Drake, Jr. wrote -
>
> tpassin@home.com writes:
>  > Well, if you don't know what attributes to expect - like you don't have
a
>  > DTD and you want to display an more-or-less unknown document - you want
to
>  > iterate over the attributes.  If you know what attributes you want,
>
>   When iterating over these unknown attributes, do you care that you
> see them in their original order?  If so, then a sequence is
> *required*, and anything else can be derived (somewhat annoying but
> possible).  If you don't care about the *original* order, .items() on
> a mapping is sufficient.

Well, the XML Rec says that attribute order is not significant.  That makes
me think that no one should count on it.  But there are all these variant
processing methods on special subsets of XML where it could maybe be useful.
The trouble is, if someone else wants to process your XML, and doesn't use
your tools, he can't count on getting the order.  So I don't favor coding
information into the order.

This is different from writing line-oriented XML for grepping or whatever.
Someone with a full parser would still get the same results as you with your
line-oriented tools.

For that matter, does expat even preserve attribute order anyway?  Maybe
it's gone by the time Python gets the attributes.  (I don't know enough
about expat to know).

The upshot - don't let attribute order be a significant issue.

Regards,

Tom Passin