quick_xml_to_dict#
- quick_xml_to_dict(element: _Element) tuple [source]#
Convert a lxml root to a nested dict (quick and dirty)
https://lxml.de/FAQ.html#how-can-i-map-an-xml-tree-into-a-dict-of-dicts:
How can I map an XML tree into a dict of dicts?
Note that this beautiful quick-and-dirty converter expects children to have unique tag names and will silently overwrite any data that was contained in preceding siblings with the same name. For any real-world application of xml-to-dict conversion, you would better write your own, longer version of this.
- Parameters:
element (etree._Element) – Element to convert into a dict
- Returns:
XML as a nested dict