예제 #1
0
def etree_to_dict(element, iterable=(list, list.append)):
    if (element.text is None) or element.text.isspace():
        retval = odict()
        for elt in element:
            if not (elt.tag in retval):
                retval[elt.tag] = iterable[0]()
            iterable[1](retval[elt.tag], etree_to_dict(elt, iterable))

    else:
        retval = element.text

    return retval
예제 #2
0
파일: etreeconv.py 프로젝트: mnlipp/CoCy
def etree_to_dict(element, iterable=(list,list.append)):
    if (element.text is None) or element.text.isspace():
        retval = odict()
        for elt in element:
            if not (elt.tag in retval):
                retval[elt.tag] = iterable[0]()
            iterable[1](retval[elt.tag], etree_to_dict(elt, iterable))

    else:
        retval = element.text

    return retval
예제 #3
0
 def __init__(self, tns):
     self.namespaces = odict()
     self.imports = {}
     self.tns = tns
예제 #4
0
 def __init__(self):
     self.elements = odict()
     self.types = odict()