def endDocument(self): for x in self.seen: ways = 0 for y in self.seen[x]: if y.firstChild.tagName == "way": ways = ways + 1 if ways == 0: continue for y in self.seen[x]: if y.firstChild.tagName == "node": self.base.appendChild(y) OSMHandler.endDocument(self)