xml_find_root

paminco.utils.readin.xml_find_root(data, root_tag: str = 'network') xml.etree.ElementTree.Element[source]

Find root element in XML data.

Parameters
datastr, xml.etree.ElementTree.ElementTree, or xml.etree.ElementTree.Element

XML file, tree or root itself.

Returns
xml.etree.ElementTree.Element

Root element in data.

Raises
ValueError:

data is xml.etree.ElementTree.Element with a tag that differs from default_root_tag.

TypeError:

data is not valid input type.