Can ElementTree be told to preserve the order of attributes?
With help from @bobince’s answer and these two (setting attribute order, overriding module methods) I managed to get this monkey patched it’s dirty and I’d suggest using another module that better handles this scenario but when that isn’t a possibility: # ======================================================================= # Monkey patch ElementTree import xml.etree.ElementTree as ET def _serialize_xml(write, elem, encoding, qnames, … Read more