def __init__(self, options=None): if options is None: options = xmlbuilder.Options() self._options = options if self._options.filter is not None: self._filter = FilterVisibilityController(self._options.filter) else: self._filter = None self._finish_start_element = id self._parser = None self.reset()
def __init__(self, options=None): if options is None: options = xmlbuilder.Options() self._options = options if self._options.filter is not None: self._filter = FilterVisibilityController(self._options.filter) else: self._filter = None # This *really* doesn't do anything in this case, so # override it with something fast & minimal. self._finish_start_element = id self._parser = None self.reset()
whatToShow = NodeFilter.SHOW_ALL def __init__(self): self.events = [] def startContainer(self, node): self.events.append(("start", node.nodeType, str(node.nodeName))) return xmlbuilder.DOMBuilderFilter.FILTER_ACCEPT def acceptNode(self, node): self.events.append(("accept", node.nodeType, str(node.nodeName))) return xmlbuilder.DOMBuilderFilter.FILTER_ACCEPT simple_options = xmlbuilder.Options() simple_options.filter = Filter() simple_options.namespaces = 0 record_options = xmlbuilder.Options() record_options.namespaces = 0 def checkResult(src): print dom = expatbuilder.makeBuilder(simple_options).parseString(src) print dom.toxml() dom.unlink() def checkFilterEvents(src, record, what=NodeFilter.SHOW_ALL):