Miscellany
public python v1 · immutabledef cleanup(parent): print "Checking Whitespace in",parent.tagName for node in parent.childNodes: print node for node in parent.childNodes: if node.nodeType == Node.TEXT_NODE and node.data.strip() == '': print "FOUND TEXTNODE: \"",node.data,"\"" parent.removeChild(node) node.unlink() elif node.nodeType == Node.ELEMENT_NODE: print "FOUND ELEMENTNODE",node.tagName cleanup(node) else: print "FOUND SOME OTHER NODE"