libearth.compat.etree
— ElementTree compatibility layer¶
This proxy module offers a compatibility layer between several ElementTree implementations.
- If there’s installed
lxml
module, uselxml.etree
. - If
xml.etree.cElementTree
is available, use it. - If IronPython, use
xml.etree.ElementTree
withlibearth.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