xml.etree.ElementTree vs. lxml
These are some pros of the two most used libraries I would have benefit to know before choosing between them.
xml.etree.ElementTree:
- From the standard library: no needs of installing any module
lxml
- Easily write XML declaration: for instance do you need to add
standalone="no"? - Pretty printing: you can have a nice indented XML without extra code.
- Objectify functionality: It allows you to use XML as if you were dealing with a normal Python object hierarchy
.node. sourcelineallows to easily get the line of the XML element you are using.- you can use also a built-in XSD schema checker.