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

Method _getDeclarations

Lib/xml/dom/expatbuilder.py:646–680  ·  view source on GitHub ↗

Re-create the internal subset from the DocumentType node. This is only needed if we don't already have the internalSubset as a string.

(self)

Source from the content-addressed store, hash-verified

644 return fragment
645
646 def _getDeclarations(self):
647 """Re-create the internal subset from the DocumentType node.
648
649 This is only needed if we don't already have the
650 internalSubset as a string.
651 """
652 doctype = self.context.ownerDocument.doctype
653 s = ""
654 if doctype:
655 for i in range(doctype.notations.length):
656 notation = doctype.notations.item(i)
657 if s:
658 s = s + "\n "
659 s = "%s<!NOTATION %s" % (s, notation.nodeName)
660 if notation.publicId:
661 s = '%s PUBLIC "%s"\n "%s">' \
662 % (s, notation.publicId, notation.systemId)
663 else:
664 s = '%s SYSTEM "%s">' % (s, notation.systemId)
665 for i in range(doctype.entities.length):
666 entity = doctype.entities.item(i)
667 if s:
668 s = s + "\n "
669 s = "%s<!ENTITY %s" % (s, entity.nodeName)
670 if entity.publicId:
671 s = '%s PUBLIC "%s"\n "%s"' \
672 % (s, entity.publicId, entity.systemId)
673 elif entity.systemId:
674 s = '%s SYSTEM "%s"' % (s, entity.systemId)
675 else:
676 s = '%s "%s"' % (s, entity.firstChild.data)
677 if entity.notationName:
678 s = "%s NOTATION %s" % (s, entity.notationName)
679 s = s + ">"
680 return s
681
682 def _getNSattrs(self):
683 return ""

Callers 1

parseStringMethod · 0.95

Calls 1

itemMethod · 0.45

Tested by

no test coverage detected