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

Method appendChild

Lib/xml/dom/minidom.py:1624–1638  ·  view source on GitHub ↗
(self, node)

Source from the content-addressed store, hash-verified

1622 return self.version
1623
1624 def appendChild(self, node):
1625 if node.nodeType not in self._child_node_types:
1626 raise xml.dom.HierarchyRequestErr(
1627 "%s cannot be child of %s" % (repr(node), repr(self)))
1628 if node.parentNode is not None:
1629 # This needs to be done before the next test since this
1630 # may *be* the document element, in which case it should
1631 # end up re-ordered to the end.
1632 node.parentNode.removeChild(node)
1633
1634 if node.nodeType == Node.ELEMENT_NODE \
1635 and self._get_documentElement():
1636 raise xml.dom.HierarchyRequestErr(
1637 "two document elements disallowed")
1638 return Node.appendChild(self, node)
1639
1640 def removeChild(self, oldChild):
1641 try:

Callers 15

testLegalChildrenMethod · 0.95
testElementMethod · 0.95
testAddAttrMethod · 0.95
testDeleteAttrMethod · 0.95
testRemoveAttrMethod · 0.95
testRemoveAttrNSMethod · 0.95
testHasAttributeMethod · 0.95
testGetAttributeMethod · 0.95
testGetAttributeNSMethod · 0.95
testElementReprAndStrMethod · 0.95

Calls 3

_get_documentElementMethod · 0.95
removeChildMethod · 0.45
appendChildMethod · 0.45

Tested by 15

testLegalChildrenMethod · 0.76
testElementMethod · 0.76
testAddAttrMethod · 0.76
testDeleteAttrMethod · 0.76
testRemoveAttrMethod · 0.76
testRemoveAttrNSMethod · 0.76
testHasAttributeMethod · 0.76
testGetAttributeMethod · 0.76
testGetAttributeNSMethod · 0.76
testElementReprAndStrMethod · 0.76