107 nodedict = dictclass()
109 if len(node.items()) > 0:
111 nodedict.update(dict((k, _xml_unescape(v)
if isinstance(v, str)
else v)
112 for k,v
in node.items()))
116 newitem = _xml2dict_recurse (child, dictclass)
117 if isinstance(newitem, str):
118 newitem = _xml_unescape(newitem)
119 if child.tag
in nodedict:
121 if isinstance(nodedict[child.tag], list):
123 nodedict[child.tag].
append(newitem)
126 nodedict[child.tag] = [nodedict[child.tag], newitem]
129 nodedict[child.tag] = newitem
131 if node.text
is None:
134 text = node.text.strip()
136 if len(nodedict) > 0:
140 nodedict[
'_text'] = text
143 if node.text: nodedict = node.text.strip()