I'd like
<node a="2" d="1" c="2">
to be converted to
<node a="2" c="2" d="1">
Can you propose some solution with less effort?
I'd like
<node a="2" d="1" c="2">
to be converted to
<node a="2" c="2" d="1">
Can you propose some solution with less effort?
Use an XML canonicalization library. XML canonical form requires the attributes to be in alphabetical order (so that two documents can be compared for equivalence by comparing them at the byte level).