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

Class DocumentType

Lib/xml/dom/minidom.py:1319–1377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1317 return self.systemId
1318
1319class DocumentType(Identified, Childless, Node):
1320 nodeType = Node.DOCUMENT_TYPE_NODE
1321 nodeValue = None
1322 name = None
1323 publicId = None
1324 systemId = None
1325 internalSubset = None
1326
1327 def __init__(self, qualifiedName):
1328 self.entities = ReadOnlySequentialNamedNodeMap()
1329 self.notations = ReadOnlySequentialNamedNodeMap()
1330 if qualifiedName:
1331 prefix, localname = _nssplit(qualifiedName)
1332 self.name = localname
1333 self.nodeName = self.name
1334
1335 def _get_internalSubset(self):
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 ")
1367 writer.write(self.name)
1368 if self.publicId:
1369 writer.write("%s PUBLIC '%s'%s '%s'"
1370 % (newl, self.publicId, newl, self.systemId))
1371 elif self.systemId:
1372 writer.write("%s SYSTEM '%s'" % (newl, self.systemId))
1373 if self.internalSubset is not None:
1374 writer.write(" [")
1375 writer.write(self.internalSubset)
1376 writer.write("]")

Callers 2

cloneNodeMethod · 0.85
createDocumentTypeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…