|
|
@ -216,8 +216,7 @@ except ImportError: # Python 2.6
|
|
|
|
if sys.version_info[0] >= 3:
|
|
|
|
if sys.version_info[0] >= 3:
|
|
|
|
compat_etree_fromstring = xml.etree.ElementTree.fromstring
|
|
|
|
compat_etree_fromstring = xml.etree.ElementTree.fromstring
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
# on python 2.x the the attributes of a node are str objects instead of
|
|
|
|
# on python 2.x the the attributes of a node aren't always unicode objects
|
|
|
|
# unicode
|
|
|
|
|
|
|
|
etree = xml.etree.ElementTree
|
|
|
|
etree = xml.etree.ElementTree
|
|
|
|
|
|
|
|
|
|
|
|
# on 2.6 XML doesn't have a parser argument, function copied from CPython
|
|
|
|
# on 2.6 XML doesn't have a parser argument, function copied from CPython
|
|
|
@ -231,6 +230,7 @@ else:
|
|
|
|
def _element_factory(*args, **kwargs):
|
|
|
|
def _element_factory(*args, **kwargs):
|
|
|
|
el = etree.Element(*args, **kwargs)
|
|
|
|
el = etree.Element(*args, **kwargs)
|
|
|
|
for k, v in el.items():
|
|
|
|
for k, v in el.items():
|
|
|
|
|
|
|
|
if isinstance(v, bytes):
|
|
|
|
el.set(k, v.decode('utf-8'))
|
|
|
|
el.set(k, v.decode('utf-8'))
|
|
|
|
return el
|
|
|
|
return el
|
|
|
|
|
|
|
|
|
|
|
|