Skip to content

Commit b92b565

Browse files
gh-151943: Document minidom specific differences in the minidom docs
Each of the NodeList and NamedNodeMap interfaces has two implementations in minidom, which support additional operations. Move this and the notes about strictErrorChecking and Attr.specified out of the documentation of the generic DOM interface.
1 parent 7fa7f46 commit b92b565

2 files changed

Lines changed: 20 additions & 15 deletions

File tree

Doc/library/xml.dom.minidom.rst

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,24 @@ rules apply:
245245
Instead, :mod:`!xml.dom.minidom` uses standard Python exceptions such as
246246
:exc:`TypeError` and :exc:`AttributeError`.
247247

248-
* The :mod:`!xml.dom.minidom` implementation of :class:`~xml.dom.NodeList`
249-
is a subclass of :class:`list`.
250-
In addition to the interface defined in the DOM specification,
251-
it supports all list operations, which are much more "Pythonic".
252-
Nodes which cannot have children use another implementation,
253-
which is a subclass of :class:`tuple`.
248+
* Each of the :class:`~xml.dom.NodeList` and :class:`~xml.dom.NamedNodeMap`
249+
interfaces has two implementations, which provide additional methods and
250+
operations.
251+
252+
:attr:`~xml.dom.Node.childNodes` is a subclass of :class:`list`, or, for
253+
nodes which cannot have children, a subclass of :class:`tuple`.
254+
It supports iteration, concatenation, indexing and slicing.
255+
256+
:attr:`~xml.dom.Node.attributes` supports ``len()``, the :keyword:`in`
257+
operator, subscription by a name or by a ``(namespaceURI, localName)``
258+
tuple, assignment and deletion, and the methods :meth:`!get`, :meth:`!keys`,
259+
:meth:`!keysNS`, :meth:`!values`, :meth:`!items` and :meth:`!itemsNS`.
260+
:attr:`~xml.dom.DocumentType.entities` and
261+
:attr:`~xml.dom.DocumentType.notations` are read-only and support only
262+
``len()`` and subscription by a name.
263+
264+
* :attr:`~xml.dom.Document.strictErrorChecking` and
265+
:attr:`~xml.dom.Attr.specified` are always ``False``.
254266

255267
The following interfaces have no implementation in :mod:`!xml.dom.minidom`:
256268

Doc/library/xml.dom.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,6 @@ inherits properties from :class:`Node`.
635635
.. attribute:: Document.strictErrorChecking
636636

637637
Whether error checking is enforced.
638-
Always ``False`` in :mod:`xml.dom.minidom`.
639638

640639

641640
.. attribute:: Document.documentURI
@@ -926,7 +925,6 @@ and :attr:`~Node.nextSibling` are always ``None``.
926925

927926
Whether the value of the attribute was explicitly set in the document,
928927
as opposed to being defaulted from the DTD.
929-
Always ``False`` in :mod:`xml.dom.minidom`.
930928
This is a read-only attribute.
931929

932930

@@ -995,13 +993,8 @@ NamedNodeMap Objects
995993
Remove and return the node with the given namespace URI and local name.
996994
Raise :exc:`NotFoundErr` if there is no such node.
997995

998-
:mod:`xml.dom.minidom` provides additional methods which make the attribute
999-
map of an element behave more like a mapping: :meth:`!get`, :meth:`!keys`,
1000-
:meth:`!keysNS`, :meth:`!values`, :meth:`!items` and :meth:`!itemsNS`, as well
1001-
as ``len()``, ``in``, subscription and deletion. They are not available for
1002-
:attr:`DocumentType.entities` and :attr:`DocumentType.notations`, which are
1003-
read-only. You can also use the standardized :meth:`!getAttribute\*` family of
1004-
methods on the :class:`Element` objects.
996+
You can also use the standardized :meth:`!getAttribute\*` family of methods
997+
on the :class:`Element` objects.
1005998

1006999

10071000
.. _dom-documentfragment-objects:

0 commit comments

Comments
 (0)