node_to_dict#
- sunpy.util.xml.node_to_dict(node)[source]#
Scans through the children of the node and makes a dictionary from the content.
Three cases are differentiated:
If the node contains no other nodes, it is a text-node and
{nodeName: text}is merged into the dictionary.If the node has the attribute
methodset totrue, then it’s children will be appended to a list and this list is merged to the dictionary in the form:{nodeName:list}.Else, will call itself recursively on the nodes children (merging
{nodeName: node_to_dict()}to the dictionary).
- Parameters:
node (
xml.etree.ElementTree.Element) – A XML element node.- Returns:
dict– The XML element node as a dictionary.