I need to parse an XML document and then write each node to separate files that support the exact order of the attributes. Therefore, if I have an input file, for example:
<item a="a" b="b" c="c"/>
<item a="a1" b="b2" c="c3"/>
The output should consist of 2 files with each element. Now, if xml.dom.minidom is used - the order of the attributes changes in the output (I can get - <item b="b" c="c" **a="a"**/>)
I found the pxdom lib, it keeps order, but very, very slow (the minidom partition takes 0.08 seconds, the pxdom parsing takes 2.5 seconds).
Are there any other python libraries that can save attributes?
UPD: libarry must also contain upper and lower case. Thus, "Item" is not equal to "item"
source
share