MCPcopy Index your code
hub / github.com/python/cpython / acceptNode

Method acceptNode

Lib/xml/dom/expatbuilder.py:475–493  ·  view source on GitHub ↗
(self, node)

Source from the content-addressed store, hash-verified

473 return FILTER_ACCEPT
474
475 def acceptNode(self, node):
476 mask = self._nodetype_mask[node.nodeType]
477 if self.filter.whatToShow & mask:
478 val = self.filter.acceptNode(node)
479 if val == FILTER_INTERRUPT:
480 raise ParseEscape
481 if val == FILTER_SKIP:
482 # move all child nodes to the parent, and remove this node
483 parent = node.parentNode
484 for child in node.childNodes[:]:
485 parent.appendChild(child)
486 # node is handled by the caller
487 return FILTER_REJECT
488 if val not in _ALLOWED_FILTER_RETURNS:
489 raise ValueError(
490 "acceptNode() returned illegal value: " + repr(val))
491 return val
492 else:
493 return FILTER_ACCEPT
494
495 _nodetype_mask = {
496 Node.ELEMENT_NODE: NodeFilter.SHOW_ELEMENT,

Callers 6

pi_handlerMethod · 0.45
entity_decl_handlerMethod · 0.45
notation_decl_handlerMethod · 0.45
comment_handlerMethod · 0.45
_finish_end_elementMethod · 0.45

Calls 1

appendChildMethod · 0.45

Tested by

no test coverage detected