Skip to content

Commit fbdb382

Browse files
committed
Docs: clarify DocumentType identifiers
1 parent 6dad8b8 commit fbdb382

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎Doc/library/xml.dom.rst‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,13 +571,23 @@ following attributes:
571571
.. attribute:: DocumentType.publicId
572572

573573
The public identifier for the external subset of the document type definition,
574-
or ``None`` if the ``DOCTYPE`` declaration does not specify it.
574+
or ``None`` if the ``DOCTYPE`` declaration does not specify it. A ``PUBLIC``
575+
``DOCTYPE`` declaration always has both a public and a system identifier.
575576

576577

577578
.. attribute:: DocumentType.systemId
578579

579580
The system identifier, a URI, for the external subset of the document type
580581
definition, or ``None`` if the ``DOCTYPE`` declaration does not specify it.
582+
A ``SYSTEM`` ``DOCTYPE`` declaration has a system identifier but no public
583+
identifier.
584+
585+
For a parsed XML document, ``publicId`` and ``systemId`` correspond to the
586+
external identifier in the ``DOCTYPE`` declaration: both are non-``None`` for
587+
a ``PUBLIC`` declaration, only ``systemId`` is non-``None`` for a ``SYSTEM``
588+
declaration, and both are ``None`` when there is no external identifier.
589+
:meth:`DOMImplementation.createDocumentType` does not validate the identifiers,
590+
so programmatically created objects may have other combinations.
581591

582592

583593
.. attribute:: DocumentType.internalSubset

0 commit comments

Comments
 (0)