quick_xml_to_dict(element: _Element) tuple[source]#

Convert a lxml root to a nested dict (quick and dirty)


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.


element (etree._Element) – Element to convert into a dict


XML as a nested dict