public abstract class NodeOverNodeInfo
extends java.lang.Object
implements org.w3c.dom.Node
The class provides read-only access to the tree; methods that request updates all fail with an UnsupportedOperationException.
Modifier and Type | Field and Description |
---|---|
protected NodeInfo |
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
Constructor and Description |
---|
NodeOverNodeInfo() |
Modifier and Type | Method and Description |
---|---|
org.w3c.dom.Node |
appendChild(org.w3c.dom.Node newChild)
Adds the node
newChild to the end of the list of children
of this node. |
org.w3c.dom.Node |
cloneNode(boolean deep)
Returns a duplicate of this node, i.e., serves as a generic copy
constructor for nodes.
|
short |
compareDocumentPosition(org.w3c.dom.Node other)
Compare the position of the (other) node in document order with the reference node (this node).
|
protected static void |
disallowUpdate()
Internal method used to indicate that update operations are not allowed
|
boolean |
equals(java.lang.Object obj)
The equals() method returns true for two Node objects that represent the same
conceptual DOM Node.
|
org.w3c.dom.NamedNodeMap |
getAttributes()
Return a
NamedNodeMap containing the attributes of this node (if
it is an Element ) or null otherwise. |
java.lang.String |
getBaseURI()
Get the base URI for the node.
|
org.w3c.dom.NodeList |
getChildNodes()
Return a
NodeList that contains all children of this node. |
java.lang.Object |
getFeature(java.lang.String feature,
java.lang.String version)
Get a feature of this node.
|
org.w3c.dom.Node |
getFirstChild()
Get first child
|
org.w3c.dom.Node |
getLastChild()
Get last child
|
java.lang.String |
getLocalName()
Get the local name of this node, following the DOM rules
|
java.lang.String |
getNamespaceURI()
The namespace URI of this node, or
null if it is
unspecified. |
org.w3c.dom.Node |
getNextSibling()
Get next sibling node
|
java.lang.String |
getNodeName()
Get the name of this node, following the DOM rules
|
short |
getNodeType()
Get the type of this node (node kind, in XPath terminology).
|
java.lang.String |
getNodeValue()
Get the node value (as defined in the DOM).
|
org.w3c.dom.Document |
getOwnerDocument()
Return the
Document object associated with this node. |
org.w3c.dom.Node |
getParentNode()
Find the parent node of this node.
|
java.lang.String |
getPrefix()
The namespace prefix of this node, or
null if it is
unspecified. |
org.w3c.dom.Node |
getPreviousSibling()
Get the previous sibling of the node
|
java.lang.String |
getTextContent()
Get the text content of a node.
|
NodeInfo |
getUnderlyingNodeInfo()
Get the Saxon NodeInfo object representing this node
|
java.lang.Object |
getUserData(java.lang.String key)
Get user data associated with this node.
|
boolean |
hasAttributes()
Returns whether this node has any attributes.
|
boolean |
hasChildNodes()
Determine whether the node has any children.
|
int |
hashCode()
Return a hashCode
|
org.w3c.dom.Node |
insertBefore(org.w3c.dom.Node newChild,
org.w3c.dom.Node refChild)
Insert the node
newChild before the existing child node
refChild . |
boolean |
isDefaultNamespace(java.lang.String namespaceURI)
Test whether a particular namespace is the default namespace.
|
boolean |
isEqualNode(org.w3c.dom.Node arg)
Compare whether two nodes have the same content.
|
boolean |
isSameNode(org.w3c.dom.Node other)
Determine whether this is the same node as another node.
|
boolean |
isSupported(java.lang.String feature,
java.lang.String version)
Tests whether the DOM implementation implements a specific feature and
that feature is supported by this node.
|
java.lang.String |
lookupNamespaceURI(java.lang.String prefix)
Find the URI corresponding to a given in-scope prefix
|
java.lang.String |
lookupPrefix(java.lang.String namespaceURI)
Get the (first) prefix assigned to a specified namespace URI, or null
if the namespace is not in scope.
|
void |
normalize()
Puts all
Text nodes in the full depth of the sub-tree
underneath this Node , including attribute nodes, into a
"normal" form where only structure (e.g., elements, comments,
processing instructions, CDATA sections, and entity references)
separates Text nodes, i.e., there are neither adjacent
Text nodes nor empty Text nodes. |
org.w3c.dom.Node |
removeChild(org.w3c.dom.Node oldChild)
Remove the child node indicated by
oldChild from the
list of children, and returns it. |
org.w3c.dom.Node |
replaceChild(org.w3c.dom.Node newChild,
org.w3c.dom.Node oldChild)
Replace the child node
oldChild with
newChild in the list of children, and returns the
oldChild node. |
void |
setNodeValue(java.lang.String nodeValue)
Set the node value.
|
void |
setPrefix(java.lang.String prefix)
Set the namespace prefix of this node.
|
void |
setTextContent(java.lang.String textContent)
Set the text content of a node.
|
java.lang.Object |
setUserData(java.lang.String key,
java.lang.Object data,
org.w3c.dom.UserDataHandler handler)
Set user data.
|
static NodeOverNodeInfo |
wrap(NodeInfo node)
Factory method to construct a DOM node that wraps an underlying Saxon NodeInfo
|
protected NodeInfo node
public NodeInfo getUnderlyingNodeInfo()
public static NodeOverNodeInfo wrap(NodeInfo node)
node
- the Saxon NodeInfo objectpublic final boolean isSameNode(org.w3c.dom.Node other)
isSameNode
in interface org.w3c.dom.Node
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to be comparedpublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String getBaseURI()
getBaseURI
in interface org.w3c.dom.Node
public java.lang.String getNodeName()
getNodeName
in interface org.w3c.dom.Node
public java.lang.String getLocalName()
getLocalName
in interface org.w3c.dom.Node
public boolean hasChildNodes()
hasChildNodes
in interface org.w3c.dom.Node
true
if this node has any attributes,
false
otherwise.public boolean hasAttributes()
hasAttributes
in interface org.w3c.dom.Node
true
if this node has any attributes,
false
otherwise.public short getNodeType()
Type
) are the same as those assigned in the DOMgetNodeType
in interface org.w3c.dom.Node
public org.w3c.dom.Node getParentNode()
getParentNode
in interface org.w3c.dom.Node
public org.w3c.dom.Node getPreviousSibling()
getPreviousSibling
in interface org.w3c.dom.Node
public org.w3c.dom.Node getNextSibling()
getNextSibling
in interface org.w3c.dom.Node
public org.w3c.dom.Node getFirstChild()
getFirstChild
in interface org.w3c.dom.Node
public org.w3c.dom.Node getLastChild()
getLastChild
in interface org.w3c.dom.Node
public java.lang.String getNodeValue()
getNodeValue
in interface org.w3c.dom.Node
public void setNodeValue(java.lang.String nodeValue) throws org.w3c.dom.DOMException
setNodeValue
in interface org.w3c.dom.Node
org.w3c.dom.DOMException
public org.w3c.dom.NodeList getChildNodes()
NodeList
that contains all children of this node. If
there are no children, this is a NodeList
containing no
nodes.getChildNodes
in interface org.w3c.dom.Node
public org.w3c.dom.NamedNodeMap getAttributes()
NamedNodeMap
containing the attributes of this node (if
it is an Element
) or null
otherwise. Note that this
implementation changed in Saxon 8.8 to treat namespace declarations as attributes.getAttributes
in interface org.w3c.dom.Node
public org.w3c.dom.Document getOwnerDocument()
Document
object associated with this node.getOwnerDocument
in interface org.w3c.dom.Node
public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild) throws org.w3c.dom.DOMException
newChild
before the existing child node
refChild
. Always fails.insertBefore
in interface org.w3c.dom.Node
newChild
- The node to insert.refChild
- The reference node, i.e., the node before which the
new node must be inserted.org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Always raised.public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild) throws org.w3c.dom.DOMException
oldChild
with
newChild
in the list of children, and returns the
oldChild
node. Always fails.replaceChild
in interface org.w3c.dom.Node
newChild
- The new node to put in the child list.oldChild
- The node being replaced in the list.org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Always raised.public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild) throws org.w3c.dom.DOMException
oldChild
from the
list of children, and returns it. Always fails.removeChild
in interface org.w3c.dom.Node
oldChild
- The node being removed.org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Always raised.public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild) throws org.w3c.dom.DOMException
newChild
to the end of the list of children
of this node. Always fails.appendChild
in interface org.w3c.dom.Node
newChild
- The node to add.org.w3c.dom.DOMException
- public org.w3c.dom.Node cloneNode(boolean deep)
cloneNode
in interface org.w3c.dom.Node
deep
- If true
, recursively clone the subtree under
the specified node; if false
, clone only the node
itself (and its attributes, if it is an Element
).public void normalize()
Text
nodes in the full depth of the sub-tree
underneath this Node
, including attribute nodes, into a
"normal" form where only structure (e.g., elements, comments,
processing instructions, CDATA sections, and entity references)
separates Text
nodes, i.e., there are neither adjacent
Text
nodes nor empty Text
nodes.normalize
in interface org.w3c.dom.Node
public boolean isSupported(java.lang.String feature, java.lang.String version)
isSupported
in interface org.w3c.dom.Node
feature
- The name of the feature to test. This is the same name
which can be passed to the method hasFeature
on
DOMImplementation
.version
- This is the version number of the feature to test. In
Level 2, version 1, this is the string "2.0". If the version is not
specified, supporting any version of the feature will cause the
method to return true
.true
if the specified feature is supported
on this node, false
otherwise.public java.lang.String getNamespaceURI()
null
if it is
unspecified.
ELEMENT_NODE
and
ATTRIBUTE_NODE
and nodes created with a DOM Level 1
method, such as createElement
from the
Document
interface, this is always null
.
Per the Namespaces in XML Specification an attribute does not
inherit its namespace from the element it is attached to. If an
attribute is not explicitly given a namespace, it simply has no
namespace.getNamespaceURI
in interface org.w3c.dom.Node
public java.lang.String getPrefix()
null
if it is
unspecified.
ELEMENT_NODE
and
ATTRIBUTE_NODE
and nodes created with a DOM Level 1
method, such as createElement
from the
Document
interface, this is always null
.getPrefix
in interface org.w3c.dom.Node
public void setPrefix(java.lang.String prefix) throws org.w3c.dom.DOMException
setPrefix
in interface org.w3c.dom.Node
org.w3c.dom.DOMException
public short compareDocumentPosition(org.w3c.dom.Node other) throws org.w3c.dom.DOMException
compareDocumentPosition
in interface org.w3c.dom.Node
other
- the other node.org.w3c.dom.DOMException
- if an error occurspublic java.lang.String getTextContent() throws org.w3c.dom.DOMException
getTextContent
in interface org.w3c.dom.Node
org.w3c.dom.DOMException
- if a dynamic error occurspublic void setTextContent(java.lang.String textContent) throws java.lang.UnsupportedOperationException
setTextContent
in interface org.w3c.dom.Node
textContent
- the new text content of the nodejava.lang.UnsupportedOperationException
- alwayspublic java.lang.String lookupPrefix(java.lang.String namespaceURI)
lookupPrefix
in interface org.w3c.dom.Node
namespaceURI
- the namespace whose prefix is requiredpublic boolean isDefaultNamespace(java.lang.String namespaceURI)
isDefaultNamespace
in interface org.w3c.dom.Node
namespaceURI
- the namespace to be testedpublic java.lang.String lookupNamespaceURI(java.lang.String prefix)
lookupNamespaceURI
in interface org.w3c.dom.Node
prefix
- The namespace prefix whose namespace URI is required.public boolean isEqualNode(org.w3c.dom.Node arg)
isEqualNode
in interface org.w3c.dom.Node
arg
- The node to be compared. This must wrap a Saxon NodeInfo.public java.lang.Object getFeature(java.lang.String feature, java.lang.String version)
getFeature
in interface org.w3c.dom.Node
feature
- the required featureversion
- the version of the required featurepublic java.lang.Object setUserData(java.lang.String key, java.lang.Object data, org.w3c.dom.UserDataHandler handler)
setUserData
in interface org.w3c.dom.Node
key
- name of the user datadata
- value of the user datahandler
- handler for the user datapublic java.lang.Object getUserData(java.lang.String key)
getUserData
in interface org.w3c.dom.Node
key
- identifies the user data requiredprotected static void disallowUpdate() throws org.w3c.dom.DOMException
org.w3c.dom.DOMException
- always, to indicate that update is not supported in this DOM implementationCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.