2

I have an element node like

<Relationship Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Id="rId61" Target="media/image1.png"/>

I need the attributes to be sorted in an order. The output should look like

<Relationship Id="rId61" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="media/image1.png"/>

How do i rearrange this? Currently I am using lxml library

Thanks

Sangamesh Hs
  • 1,397
  • 2
  • 22
  • 37

1 Answers1

1

There is no way to set a specific order of element attributes using lxml. element.attrib is a dictionary, dictionaries in python are unordered collections.

Also see:

Community
  • 1
  • 1
alecxe
  • 441,113
  • 110
  • 1,021
  • 1,148