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

Method cloneNode

Lib/xml/dom/minidom.py:1338–1363  ·  view source on GitHub ↗
(self, deep)

Source from the content-addressed store, hash-verified

1336 return self.internalSubset
1337
1338 def cloneNode(self, deep):
1339 if self.ownerDocument is None:
1340 # it's ok
1341 clone = DocumentType(None)
1342 clone.name = self.name
1343 clone.nodeName = self.name
1344 operation = xml.dom.UserDataHandler.NODE_CLONED
1345 if deep:
1346 clone.entities._seq = []
1347 clone.notations._seq = []
1348 for n in self.notations._seq:
1349 notation = Notation(n.nodeName, n.publicId, n.systemId)
1350 clone.notations._seq.append(notation)
1351 n._call_user_data_handler(operation, n, notation)
1352 for e in self.entities._seq:
1353 entity = Entity(e.nodeName, e.publicId, e.systemId,
1354 e.notationName)
1355 entity.actualEncoding = e.actualEncoding
1356 entity.encoding = e.encoding
1357 entity.version = e.version
1358 clone.entities._seq.append(entity)
1359 e._call_user_data_handler(operation, e, entity)
1360 self._call_user_data_handler(operation, self, clone)
1361 return clone
1362 else:
1363 return None
1364
1365 def writexml(self, writer, indent="", addindent="", newl=""):
1366 writer.write("<!DOCTYPE ")

Callers

nothing calls this directly

Calls 5

DocumentTypeClass · 0.85
NotationClass · 0.85
EntityClass · 0.85
appendMethod · 0.45

Tested by

no test coverage detected