public abstract class ParentNodeImpl extends NodeImpl implements Node, Cloneable
NodeImpl, while nodes that support child elements are extended from ParentNodeImpl containing the additional member variables required to support child nodes.This class is abstract. All derived classes must extend NodeImpl.getNodeType(). In addition, derived classes might wish to extend Node.cloneNode(boolean), equals(java.lang.Object) and Object.toString() and othe methods as necessary. Many methods cannot be extended.
Node, NodeImplATTLIST_DECL_NODE, ELEMENT_DECL_NODE, PARAM_ENTITY_NODEATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE| Modifier | Constructor and Description |
|---|---|
protected | ParentNodeImpl(DocumentImpl owner, String name, String value)Hidden constructor creates a new node. |
| Modifier and Type | Method and Description |
|---|---|
Node | appendChild(Node newChild)InsertnewChild as the last child of this parent. |
protected NodeImpl | castNewChild(Node newChild)Checks whethernewChild can be added to this node as a child, and if so, performs a necessary cast. |
protected NodeImpl | castOldChild(Node oldChild)Checks whetheroldChild is a direct child of this node, and if so, performs a necessary cast. |
protected void | cloneInto(NodeImpl into, boolean deep)This clone method is called after a new node has been constructed to copy the contents of this node into the new one. |
protected org.w3c.dom.traversal.NodeIterator | createNodeIterator(boolean tree, int whatToShow, org.w3c.dom.traversal.NodeFilter nodeFilter) |
boolean | equals(Object other)Returns true if this node andother are identical by content but not context. |
NodeList | getChildNodes()Returns a NodeList object that can be used to traverse this node's children. |
Node | getFirstChild()Returns the first child of the node. |
Node | getLastChild()Returns the last child of the node. |
boolean | hasChildNodes()Return true if there are any childern to this node. |
Node | insertBefore(Node newChild, Node refChild)InsertnewChild in this parent, before the existing childrefChild. |
void | normalize() |
Node | removeChild(Node oldChild)RemoveoldChild from this parent. |
void | removeInnerIterator(InnerIterator iterator) |
Node | replaceChild(Node newChild, Node oldChild)ReplaceoldChild withnewChild, adding the new child and removing the old one. |
getAttributes, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, isReadOnly, makeReadOnly, setNodeValue, setOwnerDocument, setPrefix, supportsclone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcloneNode, compareDocumentPosition, getAttributes, getBaseURI, getFeature, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, setNodeValue, setPrefix, setTextContent, setUserDataprotected ParentNodeImpl(DocumentImpl owner, String name, String value) throws DOMException
DocumentImpl or DocumentTypeImpl,IfcheckName is true, the supplied named is assumed to be a valid XML name token, one that can contain any Unicode letters and digits, must start with a letter, and may also contain hyphen, underscore, digit or colon.
owner - Document owner of this node, or nullname - Name of nodevalue - Initial value of node or nullDOMException -INVALID_CHARACTER_ERR Node name cannot contain whitespace or non-printable characterspublic final NodeList getChildNodes()
NodeImplNodeList object that can be used to traverse this node's children. The node list is live, so every change to this node is reflected in it. If the node does not support children, returns an empty node list.getChildNodes in interface NodegetChildNodes in class NodeImplNodeList on this nodeNodeListpublic final Node getFirstChild()
NodeImplgetFirstChild in interface NodegetFirstChild in class NodeImplpublic final Node getLastChild()
NodeImplgetLastChild in interface NodegetLastChild in class NodeImplpublic final boolean hasChildNodes()
NodeImplNodeImpl.getChildNodes().hasChildNodes in interface NodehasChildNodes in class NodeImplpublic void normalize()
public final Node appendChild(Node newChild)
NodeImplIfnewChild is null,newChild is not a compatible type, or childern are not supported by this node type, an exception is thrown.
newChild is removed from its original parent before adding to this parent. IfnewChild is a DocumentFragment, all its children are inserted one by one into this parent.
appendChild in interface NodeappendChild in class NodeImplnewChild - The new child to addpublic final Node insertBefore(Node newChild, Node refChild) throws DOMException
NodeImplNodeImpl.appendChild(org.w3c.dom.Node).IfnewChild is null,newChild does not belong to this DOM,refChild is not a direct child of this node, or childern are not supported by this node type, an exception is thrown.
newChild is removed from its original parent before adding to this parent. IfnewChild is a DocumentFragment, all its children are inserted one by one into this parent.
insertBefore in interface NodeinsertBefore in class NodeImplnewChild - The new child to addrefChild - Insert new child before this child, or insert at the end if this child is nullDOMException -NO_MODIFICATION_ALLOWED_ERR Node is read-only and cannot be modifiedpublic final Node removeChild(Node oldChild) throws DOMException
NodeImplremoveChild in interface NoderemoveChild in class NodeImploldChild - The child to removeDOMException -NO_MODIFICATION_ALLOWED_ERR Node is read-only and cannot be modifiedpublic final Node replaceChild(Node newChild, Node oldChild) throws DOMException
NodeImplIfnewChild does not belong to this DOM,oldChild is not a direct child of this parent, or childern are not supported by this node type, an exception is thrown.
newChild is removed from its original parent before adding to this parent. IfnewChild is a DocumentFragment, all its children are inserted one by one into this parent.
replaceChild in interface NodereplaceChild in class NodeImplnewChild - The new child to addoldChild - The old child to take awayDOMException -NO_MODIFICATION_ALLOWED_ERR Node is read-only and cannot be modifiedprotected NodeImpl castNewChild(Node newChild) throws DOMException
The following rules govern the allowednewChild types:
Attr,newChild must be either a Text or an EntityReferenceDocumentType,newChild must be either an Entity or a Notation.Element, a CharacterData derived type, a DocumentFragment, an EntityReference or a ProcessingInstruction.newChild - New child nodeNodeImplDOMException -HIERARCHY_REQUEST_ERRnewChild is null, does not belong to this DOM, or its node type is not supported for this parentprotected final NodeImpl castOldChild(Node oldChild) throws DOMException
oldChild - Old child nodeNodeImplDOMException -NOT_FOUND_ERRoldChild is null, or not a direct child of this nodeprotected org.w3c.dom.traversal.NodeIterator createNodeIterator(boolean tree, int whatToShow, org.w3c.dom.traversal.NodeFilter nodeFilter)
public void removeInnerIterator(InnerIterator iterator)
protected void cloneInto(NodeImpl into, boolean deep)
NodeImplNodeImpl.equals(java.lang.Object)).into must be a valid node of the exact same class as this one.deep is true if deep cloning (includes all children nodes) is to be performed. Ifdeep is false, the clone might not pass the equality test.
Derived classes override and call this method to add per-class variable copying. This method is called by Node.cloneNode(boolean) and the default Object.clone() method.
Contents cloning duplicates the node's name and value, and its children. It does not duplicate it's context, that is, the node's parent or sibling. Initially a clone node has no parents or siblings. However, the node does belong to the same document, since all nodes must belong to some document. The cloned node is never read-only.
public boolean equals(Object other)
NodeImplNodeImpl.equals(java.lang.Object) on each pairNote that for large document roots, the equality operation can be very expensive.
Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© 2026 Mindus SARL. All rights reserved.