Python's xml package includes numerous modules that parse XML files. There is also a Document Object Model (DOM) implementation that can produce an XML document. As with the previous json module, XML is not a complete persistence solution for Python objects. Because of the wide adoption of the XML files, however, it often becomes necessary to convert between Python objects and XML documents.
Working with XML files involves a manual mapping between Python objects and XML structures. We need to design the mapping carefully, remaining mindful of the constraints of XML's notation. This can be difficult because of the mismatch between the expressive powers of objects and the strictly hierarchical nature of an XML document.
The content of an XML attribute or tag is pure text. When loading an XML document, we'll need to convert these values...