@@ -95,7 +95,7 @@ The :mod:`!xml.dom` contains the following functions:
9595 module name of a DOM implementation, or ``None ``. If it is not ``None ``, imports
9696 the corresponding module and returns a :class: `DOMImplementation ` object if the
9797 import succeeds. If no name is given, and if the environment variable
98- :envvar: `PYTHON_DOM ` is set, this variable is used to find the implementation.
98+ :envvar: `! PYTHON_DOM ` is set, this variable is used to find the implementation.
9999
100100 If name is not given, this examines the available implementations to find one
101101 with the required feature set. If no implementation can be found, raise an
@@ -199,6 +199,9 @@ in Python.
199199DOMImplementation Objects
200200^^^^^^^^^^^^^^^^^^^^^^^^^
201201
202+ .. class :: DOMImplementation
203+ :no-typesetting:
204+
202205The :class: `DOMImplementation ` interface provides a way for applications to
203206determine the availability of particular features in the DOM they are using.
204207DOM Level 2 added the ability to create new :class: `Document ` and
@@ -233,6 +236,9 @@ DOM Level 2 added the ability to create new :class:`Document` and
233236Node Objects
234237^^^^^^^^^^^^
235238
239+ .. class :: Node
240+ :no-typesetting:
241+
236242All of the components of an XML document are subclasses of :class: `Node `.
237243
238244
@@ -428,6 +434,9 @@ All of the components of an XML document are subclasses of :class:`Node`.
428434NodeList Objects
429435^^^^^^^^^^^^^^^^
430436
437+ .. class :: NodeList
438+ :no-typesetting:
439+
431440A :class: `NodeList ` represents a sequence of nodes. These objects are used in
432441two ways in the DOM Core recommendation: an :class: `Element ` object provides
433442one as its list of child nodes, and the :meth: `getElementsByTagName ` and
@@ -467,6 +476,9 @@ If a DOM implementation supports modification of the document, the
467476DocumentType Objects
468477^^^^^^^^^^^^^^^^^^^^
469478
479+ .. class :: DocumentType
480+ :no-typesetting:
481+
470482Information about the notations and entities declared by a document (including
471483the external subset if the parser uses it and can provide the information) is
472484available from a :class: `DocumentType ` object. The :class: `DocumentType ` for a
@@ -527,6 +539,9 @@ following attributes:
527539Document Objects
528540^^^^^^^^^^^^^^^^
529541
542+ .. class :: Document
543+ :no-typesetting:
544+
530545A :class: `Document ` represents an entire XML document, including its constituent
531546elements, attributes, processing instructions, comments etc. Remember that it
532547inherits properties from :class: `Node `.
@@ -629,6 +644,13 @@ inherits properties from :class:`Node`.
629644 :class: `Element ` object to use the newly created attribute instance.
630645
631646
647+ .. method :: Document.getElementById(id)
648+
649+ Return the element with the given ID, or ``None ``.
650+ Only attributes declared as being of type ID in the DTD
651+ or by :meth: `Element.setIdAttribute ` are searched.
652+
653+
632654.. method :: Document.getElementsByTagName(tagName)
633655
634656 Search for all descendants (direct children, children's children, etc.) with a
@@ -659,6 +681,9 @@ inherits properties from :class:`Node`.
659681Element Objects
660682^^^^^^^^^^^^^^^
661683
684+ .. class :: Element
685+ :no-typesetting:
686+
662687:class: `Element ` is a subclass of :class: `Node `, so inherits all the attributes
663688of that class.
664689
@@ -782,6 +807,9 @@ of that class.
782807Attr Objects
783808^^^^^^^^^^^^
784809
810+ .. class :: Attr
811+ :no-typesetting:
812+
785813:class: `Attr ` inherits from :class: `Node `, so inherits all its attributes.
786814
787815
@@ -830,6 +858,9 @@ Attr Objects
830858NamedNodeMap Objects
831859^^^^^^^^^^^^^^^^^^^^
832860
861+ .. class :: NamedNodeMap
862+ :no-typesetting:
863+
833864:class: `NamedNodeMap ` does *not * inherit from :class: `Node `.
834865
835866
@@ -844,16 +875,71 @@ NamedNodeMap Objects
844875 in is arbitrary but will be consistent for the life of a DOM. Each item is an
845876 attribute node. Get its value with the :attr: `value ` attribute.
846877
878+
879+ .. method :: NamedNodeMap.getNamedItem(name)
880+
881+ Return the node with the given :attr: `~Attr.name `,
882+ or ``None `` if there is no such node.
883+
884+
885+ .. method :: NamedNodeMap.getNamedItemNS(namespaceURI, localName)
886+
887+ Return the node with the given namespace URI and local name,
888+ or ``None `` if there is no such node.
889+
890+
891+ .. method :: NamedNodeMap.setNamedItem(node)
892+
893+ Add *node * to the map, using its :attr: `~Attr.name ` as the key.
894+ Return the node which it replaces, or ``None `` if it replaces no node.
895+
896+
897+ .. method :: NamedNodeMap.setNamedItemNS(node)
898+
899+ Add *node * to the map,
900+ using its namespace URI and local name as the key.
901+ Return the node which it replaces, or ``None `` if it replaces no node.
902+
903+
904+ .. method :: NamedNodeMap.removeNamedItem(name)
905+
906+ Remove and return the node with the given :attr: `~Attr.name `.
907+ Raise :exc: `NotFoundErr ` if there is no such node.
908+
909+
910+ .. method :: NamedNodeMap.removeNamedItemNS(namespaceURI, localName)
911+
912+ Remove and return the node with the given namespace URI and local name.
913+ Raise :exc: `NotFoundErr ` if there is no such node.
914+
847915There are also experimental methods that give this class more mapping behavior.
848916You can use them or you can use the standardized :meth: `!getAttribute\* ` family
849917of methods on the :class: `Element ` objects.
850918
851919
920+ .. _dom-documentfragment-objects :
921+
922+ DocumentFragment Objects
923+ ^^^^^^^^^^^^^^^^^^^^^^^^
924+
925+ .. class :: DocumentFragment
926+ :no-typesetting:
927+
928+ :class: `DocumentFragment ` is a lightweight container of nodes.
929+ It is a subclass of :class: `Node `.
930+ When it is inserted into the document tree,
931+ its children are inserted instead of it,
932+ and it becomes empty.
933+
934+
852935.. _dom-characterdata-objects :
853936
854937CharacterData Objects
855938^^^^^^^^^^^^^^^^^^^^^
856939
940+ .. class :: CharacterData
941+ :no-typesetting:
942+
857943:class: `CharacterData ` represents text-like data in the XML document.
858944It is a subclass of :class: `Node `, and the base class
859945of :class: `Text `, :class: `CDATASection ` and :class: `Comment `.
@@ -904,6 +990,9 @@ Such nodes cannot have child nodes.
904990Comment Objects
905991^^^^^^^^^^^^^^^
906992
993+ .. class :: Comment
994+ :no-typesetting:
995+
907996:class: `Comment ` represents a comment in the XML document.
908997It is a subclass of :class: `CharacterData `.
909998
@@ -920,6 +1009,12 @@ It is a subclass of :class:`CharacterData`.
9201009Text and CDATASection Objects
9211010^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9221011
1012+ .. class :: Text
1013+ :no-typesetting:
1014+
1015+ .. class :: CDATASection
1016+ :no-typesetting:
1017+
9231018The :class: `Text ` interface represents text in the XML document. If the parser
9241019and DOM implementation support the DOM's XML extension, portions of the text
9251020enclosed in CDATA marked sections are stored in :class: `CDATASection ` objects.
@@ -968,6 +1063,9 @@ These interfaces extend the :class:`CharacterData` interface.
9681063ProcessingInstruction Objects
9691064^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9701065
1066+ .. class :: ProcessingInstruction
1067+ :no-typesetting:
1068+
9711069Represents a processing instruction in the XML document; this inherits from the
9721070:class: `Node ` interface and cannot have child nodes.
9731071
@@ -1186,9 +1284,9 @@ Mapping the IDL declarations ::
11861284 readonly attribute string someValue;
11871285 attribute string anotherValue;
11881286
1189- yields three accessor functions: a "get" method for :attr: `someValue `
1190- (:meth: `_get_someValue `), and "get" and "set" methods for :attr: `anotherValue `
1191- (:meth: `_get_anotherValue ` and :meth: `_set_anotherValue `). The mapping, in
1287+ yields three accessor functions: a "get" method for :attr: `! someValue `
1288+ (:meth: `! _get_someValue `), and "get" and "set" methods for :attr: `! anotherValue `
1289+ (:meth: `! _get_anotherValue ` and :meth: `! _set_anotherValue `). The mapping, in
11921290particular, does not require that the IDL attributes are accessible as normal
11931291Python attributes: ``object.someValue `` is *not * required to work, and may
11941292raise an :exc: `AttributeError `.
0 commit comments