public abstract class ParentNSNodeImpl extends ParentNodeImpl implements Node, Cloneable
AttrImpl
and ElementImpl
require support for
both child nodes and namespace handling, and only these two
extend this class.
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 other methods as necessary. Many methods cannot be extended.
This class is optimized for searching either by qualified name, namespace URI or local name. The prefix is not stored and must be calculated each time.
Node
,
ParentNodeImpl
ATTLIST_DECL_NODE, ELEMENT_DECL_NODE, PARAM_ENTITY_NODE
ATTRIBUTE_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 |
ParentNSNodeImpl(DocumentImpl owner,
String namespaceURI,
String qualifiedName,
String value)
Hidden constructor creates a new node.
|
Modifier and Type | Method and Description |
---|---|
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.
|
boolean |
equals(Object other)
Returns true if this node and other are identical by content but
not context.
|
String |
getLocalName()
Returns the local part of the qualified name of this node.
|
String |
getNamespaceURI()
Returns the namespace URI associated with this node, or null if
unspecified.
|
String |
getPrefix()
Returns the namespace prefix of this node, or null if unspecified.
|
void |
setPrefix(String newPrefix)
Sets the namespace prefix of this node.
|
appendChild, castNewChild, castOldChild, createNodeIterator, getChildNodes, getFirstChild, getLastChild, hasChildNodes, insertBefore, normalize, removeChild, removeInnerIterator, replaceChild
getAttributes, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPreviousSibling, isReadOnly, makeReadOnly, setNodeValue, setOwnerDocument, supports
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setTextContent, setUserData
protected ParentNSNodeImpl(DocumentImpl owner, String namespaceURI, String qualifiedName, String value) throws DOMException
The namespace URI is optional, the qualifiedName is checked to be a valid name with optional prefix and local name parts. If the namespace rules are violated, an exception is thrown.
owner
- Document owner of this node, or nullnamespaceURI
- The namespace URIqualifiedName
- The qualified node namevalue
- Initial value of node or nullDOMException
- INVALID_CHARACTER_ERR
Node name cannot contain whitespaces or non-printable characters
and may use ':' only in compliance with namespace rulespublic final String getNamespaceURI()
getNamespaceURI
in interface Node
getNamespaceURI
in class NodeImpl
public final String getPrefix()
public final void setPrefix(String newPrefix)
NodeImpl.getNodeName()
, which holds he qualified name of the node.public final String getLocalName()
getLocalName
in interface Node
getLocalName
in class NodeImpl
protected void cloneInto(NodeImpl into, boolean deep)
NodeImpl
NodeImpl.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. If deep 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.
cloneInto
in class ParentNodeImpl
into
- A node into which to duplicate this onedeep
- True if deep cloning is requiredpublic boolean equals(Object other)
NodeImpl
NodeImpl.equals(java.lang.Object)
on each pair
Note that for large document roots, the equality operation can be very expensive.
equals
in class ParentNodeImpl
other
- The other node to test for equalityPhantom® and NetPhantom® are registered trademarks of Mindus SARL.
© © Mindus SARL, 2024. All rights reserved.