xml_to_dict

sunpy.util.xml.xml_to_dict(xmlstring)[source] [edit on github]

Converts an XML string to a Python dictionary.

Warning

This method does not support multiple inner nodes of the same name but with different values. It always takes the last value.

Parameters

xmlstring (str) – A str of xml content.

Returns

dict – The string xml input as a dictionary.

Examples

<outer>
    <inner>one</inner>
    <inner>two</inner>
</outer>

gives you the dict:

{u'outer': {u'inner': u'two'}}

References