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
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
def __init__(self, tns): self.namespaces = odict() self.imports = {} self.tns = tns
def __init__(self): self.elements = odict() self.types = odict()