3 def elementsWithTag(el, tag):
5 """filters all elements of childNode with the specified function
6 example: nodes = elementsWithTag(childNodes, lambda x: x == "bla")"""
8 # fiiixme! (works but isn't nice)
9 if isinstance(tag, str):
11 tag = lambda x: x == s
14 if x.nodeType != xml.dom.minidom.Element.nodeType:
19 def mergeText(nodelist):
22 if node.nodeType == node.TEXT_NODE:
26 def stringToXML(text):
27 return text.replace('&', '&').replace('<', '<').replace('>', '>').replace("'", ''').replace('"', '"')