Is there a way I can preserve the original order of attributes when processing XML with minidom?
Say I have: <color red='255' green='255' blue='233' /> when I modify this with minidom the attributes are rearranged alphabetically blue, green, and red. I’d like to preserve the original order.
I am processing the file by looping through the elements returned by elements = doc.getElementsByTagName('color') and then I do assignments like this e.attributes['red'].value = '233'.
With minidom no, the datatype used to store attributes is an unordered dictionary. pxdom can do it, though it is considerably slower.