def startElement(self, name, attrs): if self.current_XMLNode is None: self.current_XMLNode = XMLNode(name=name, attrs=attrs) else: t = XMLNode(name=name, attrs=attrs) self.current_XMLNode.addChild(t) self.xmlnode_hierarchylist.append(self.current_XMLNode) self.current_XMLNode = t