@@ -232,6 +232,8 @@ DOM Level 2 added the ability to create new :class:`Document` and
232232 *qualifiedName*, *publicId*, and *systemId* strings, representing the
233233 information contained in an XML document type declaration.
234234235+ Raise :exc:`InvalidCharacterErr` if the name is not a valid XML name.
236+235237236238.. _dom-node-objects:
237239@@ -457,6 +459,10 @@ for each node type are:
457459 children, returning *newChild*. If the node was already in
458460 the tree, it is removed first.
459461462+ Raise :exc:`WrongDocumentErr` if *newChild* was created by another
463+ document, and :exc:`HierarchyRequestErr` if it is this node itself or
464+ its ancestor.
465+460466461467.. method:: Node.insertBefore(newChild, refChild)
462468@@ -465,6 +471,10 @@ for each node type are:
465471 *newChild* is returned. If *refChild* is ``None``, it inserts *newChild* at the
466472 end of the children's list.
467473474+ Raise :exc:`WrongDocumentErr` if *newChild* was created by another
475+ document, and :exc:`HierarchyRequestErr` if it is this node itself or
476+ its ancestor.
477+468478469479.. method:: Node.removeChild(oldChild)
470480@@ -479,6 +489,10 @@ for each node type are:
479489 Replace an existing node with a new node. It must be the case that *oldChild*
480490 is a child of this node; if not, :exc:`NotFoundErr` is raised.
481491492+ Raise :exc:`WrongDocumentErr` if *newChild* was created by another
493+ document, and :exc:`HierarchyRequestErr` if it is this node itself or
494+ its ancestor.
495+482496483497.. method:: Node.normalize()
484498@@ -665,6 +679,8 @@ inherits properties from :class:`Node`.
665679 document when it is created. You need to explicitly insert it with one of the
666680 other methods such as :meth:`~Node.insertBefore` or :meth:`~Node.appendChild`.
667681682+ Raise :exc:`InvalidCharacterErr` if the name is not a valid XML name.
683+668684669685.. method:: Document.createElementNS(namespaceURI, tagName)
670686@@ -673,6 +689,8 @@ inherits properties from :class:`Node`.
673689 need to explicitly insert it with one of the other methods such as
674690:meth:`~Node.insertBefore` or :meth:`~Node.appendChild`.
675691692+ Raise :exc:`InvalidCharacterErr` if the name is not a valid XML name.
693+676694677695.. method:: Document.createTextNode(data)
678696@@ -681,6 +699,16 @@ inherits properties from :class:`Node`.
681699 tree.
682700683701702+.. method:: Document.createEntityReference(name)
703+704+ Create and return a new entity reference node.
705+ The node is not inserted into the document when it is created.
706+707+ Raise :exc:`InvalidCharacterErr` if the name is not a valid XML name.
708+709+ .. versionadded:: next
710+711+684712.. method:: Document.createComment(data)
685713686714 Create and return a comment node containing the data passed as a parameter. As
@@ -694,6 +722,8 @@ inherits properties from :class:`Node`.
694722 *data* passed as parameters. As with the other creation methods, this one does
695723 not insert the node into the tree.
696724725+ Raise :exc:`InvalidCharacterErr` if the name is not a valid XML name.
726+697727698728.. method:: Document.createAttribute(name)
699729@@ -702,6 +732,8 @@ inherits properties from :class:`Node`.
702732:meth:`~Element.setAttributeNode` on the appropriate :class:`Element` object
703733 to use the newly created attribute instance.
704734735+ Raise :exc:`InvalidCharacterErr` if the name is not a valid XML name.
736+705737706738.. method:: Document.createAttributeNS(namespaceURI, qualifiedName)
707739@@ -710,6 +742,8 @@ inherits properties from :class:`Node`.
710742 element. You must use :meth:`~Element.setAttributeNode` on the appropriate
711743:class:`Element` object to use the newly created attribute instance.
712744745+ Raise :exc:`InvalidCharacterErr` if the name is not a valid XML name.
746+713747714748.. method:: Document.getElementById(id)
715749@@ -844,6 +878,8 @@ of that class.
844878845879 Set an attribute value from a string.
846880881+ Raise :exc:`InvalidCharacterErr` if the name is not a valid XML name.
882+847883848884.. method:: Element.setAttributeNode(newAttr)
849885@@ -852,6 +888,8 @@ of that class.
852888 occurs, the old attribute node will be returned. If *newAttr* is already in use,
853889:exc:`InuseAttributeErr` will be raised.
854890891+ Raise :exc:`WrongDocumentErr` if *newAttr* was created by another document.
892+855893856894.. method:: Element.setAttributeNodeNS(newAttr)
857895@@ -861,12 +899,16 @@ of that class.
861899 returned. If *newAttr* is already in use, :exc:`InuseAttributeErr` will be
862900 raised.
863901902+ Raise :exc:`WrongDocumentErr` if *newAttr* was created by another document.
903+864904865905.. method:: Element.setAttributeNS(namespaceURI, qname, value)
866906867907 Set an attribute value from a string, given a *namespaceURI* and a *qname*.
868908 Note that a qname is the whole attribute name. This is different than above.
869909910+ Raise :exc:`InvalidCharacterErr` if the name is not a valid XML name.
911+870912871913.. _dom-attr-objects:
872914@@ -972,13 +1014,19 @@ NamedNodeMap Objects
9721014 Add *node* to the map, using its :attr:`~Attr.name` as the key.
9731015 Return the node which it replaces, or ``None`` if it replaces no node.
97410161017+ Raise :exc:`WrongDocumentErr` if *node* was created by another document,
1018+ and :exc:`InuseAttributeErr` if it belongs to another element.
1019+97510209761021.. method:: NamedNodeMap.setNamedItemNS(node)
97710229781023 Add *node* to the map,
9791024 using its namespace URI and local name as the key.
9801025 Return the node which it replaces, or ``None`` if it replaces no node.
98110261027+ Raise :exc:`WrongDocumentErr` if *node* was created by another document,
1028+ and :exc:`InuseAttributeErr` if it belongs to another element.
1029+98210309831031.. method:: NamedNodeMap.removeNamedItem(name)
9841032@@ -1224,6 +1272,23 @@ The name of the notation is its :attr:`~Node.nodeName`.
12241272 The system identifier of the notation,
12251273 or ``None`` if it is not specified.
12261274 This is a read-only attribute.
1275+.. _dom-entityreference-objects:
1276+1277+EntityReference Objects
1278+^^^^^^^^^^^^^^^^^^^^^^^
1279+1280+.. class:: EntityReference
1281+:no-typesetting:
1282+1283+:class:`EntityReference` represents an entity reference in the XML document.
1284+It is a subclass of :class:`Node`.
1285+The name of the referenced entity is its :attr:`~Node.nodeName`.
1286+Its children are the replacement text of the entity, and are read-only.
1287+1288+Parsers may expand entity references,
1289+so such a node only occurs in a document if it was created explicitly.
1290+1291+.. versionadded:: next
122712921228129312291294.. _dom-exceptions: