libearth.compat.etree — ElementTree compatibility layer¶
This proxy module offers a compatibility layer between several ElementTree implementations.
- If there’s installed
lxmlmodule, uselxml.etree. - If
xml.etree.cElementTreeis available, use it. - If IronPython, use
xml.etree.ElementTreewithlibearth.compat.clrxmlreader.TreeBuilder. - Otherwise, use
xml.etree.ElementTree.
It provides the following two functions:
-
libearth.compat.etree.fromstring(string)¶ Parse the given XML
string.Parameters: string ( str,bytes,basestring) – xml string to parseReturns: the element tree object
-
libearth.compat.etree.fromstringlist(iterable)¶ Parse the given chunks of XML string.
Parameters: iterable ( collections.Iterable) – chunks of xml string to parseReturns: the element tree object