- node[elementName][childName] = []
- #node[childName] = []
- childdict = self.toDict(child)
- for value in childdict.values():
- node[elementName][childName].append(value)
+ node[elementName][childName] = []
+ # if child node has text child nodes
+ # append the children to the array as strings
+ if child.hasChildNodes() and isinstance(child.childNodes[0], minidom.Text):
+ for nextchild in child.childNodes:
+ node[elementName][childName].append(nextchild.data)
+ # convert element child node to dict
+ else:
+ childdict = self.toDict(child)
+ for value in childdict.values():
+ node[elementName][childName].append(value)