in android_sdk/AndroidExtraXMLParser.py [0:0]
def get_element_children_dict(element, schema):
result_dict = dict()
tag = ""
if len(element.getchildren()) >= 1:
for child in element.getchildren():
tag = child.tag.replace(schema, "")
if not child.getchildren():
result_dict[tag] = child.text
# the tag name gets the value of the text
else:
# if there are children, each child needs to be converted into a dict
templist = list()
for newchild in child.getchildren():
templist.append(get_element_children_dict(newchild, schema))
result_dict[tag] = templist
else:
# no grandchildren
result_dict[element.tag.replace(schema, "")] = element.text
return result_dict