xml-filter with XMLFilterBase() and XMLGenerator() shuffles attributes

infidel saint.infidel at gmail.com
Thu Dec 20 15:23:49 EST 2007


>         def startElement(self, name, attrs):
>                 self.__downstream.startElement(name, attrs)
>                 return

> I want prevent it from shuffling attributes, i.e. preserve original
> file's attribute order. Is there any ContentHandler.features*
> responsible for that?

I suspect not.  attrs is a dictionary which does not maintain order,
and XML attributes are unordered to begin with.  Is there any reason
other than aesthetics that you want the order preserved?  It shouldn't
matter to any upstream consumer of the filtered XML.



More information about the Python-list mailing list