return rdict
return tempdict
+
+
+ def filter(self, tagname, attribute, valuelist, dom = None):
+ """
+ Removes all elements where:
+ 1. tagname matches the element tag
+ 2. attribute matches the element attribte
+ 3. attribute value is in valuelist
+ """
+
+ tempdict = {}
+ if not dom:
+ dom = self.rootNode
+
+ if dom.localName in [tagname] and dom.attributes.has_key(attribute) and \
+ dom.attributes.get(attribute).value in valuelist:
+ dom.parentNode.removeChild(dom)
+
+ if dom.hasChildNodes():
+ for child in dom.childNodes:
+ self.filter(tagname, attribute, valuelist, child)
+
# vim:ts=4:expandtab