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,447
  • 3
  • 24
  • 39

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
  • 462,703
  • 120
  • 1,088
  • 1,195