[FIX]XML Base for Python2

This commit is contained in:
Fabien BOURGEOIS 2022-11-18 10:36:36 +01:00
parent 73ecdb19b5
commit 71475e3f27
1 changed files with 2 additions and 2 deletions

View File

@ -36,7 +36,7 @@ def xmlroot(tree):
def xmlchild(parent, children): def xmlchild(parent, children):
""" Handling of children (ie non root) XML Nodes with/o text and """ Handling of children (ie non root) XML Nodes with/o text and
subchildren (recursive) """ subchildren (recursive) """
if isinstance(children, str): if isinstance(children, basestring):
parent.text = children parent.text = children
elif isinstance(children, XMLDictElement): elif isinstance(children, XMLDictElement):
attrs = {str(k): str(v) for [k, v] in children.attrs.items()} attrs = {str(k): str(v) for [k, v] in children.attrs.items()}
@ -55,7 +55,7 @@ def xmln(tag='', attrs={}, children=[]):
children = attrs children = attrs
attrs = {} attrs = {}
xmldictel = partial(XMLDictElement, tag, attrs) xmldictel = partial(XMLDictElement, tag, attrs)
if isinstance(children, str): if isinstance(children, basestring):
return xmldictel([children]) return xmldictel([children])
if isinstance(children, list): if isinstance(children, list):
return xmldictel(children) return xmldictel(children)