net.sf.saxon.dom
public abstract class NodeOverNodeInfo extends Object implements Node
The class provides read-only access to the tree; methods that request updates all fail with an UnsupportedOperationException.
Field Summary | |
---|---|
protected NodeInfo | node |
Method Summary | |
---|---|
Node | appendChild(Node newChild)
Adds the node newChild to the end of the list of children
of this node. |
Node | cloneNode(boolean deep)
Returns a duplicate of this node, i.e., serves as a generic copy
constructor for nodes. |
short | compareDocumentPosition(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 |
NamedNodeMap | getAttributes()
Return a NamedNodeMap containing the attributes of this node (if
it is an Element ) or null otherwise. |
String | getBaseURI()
Get the base URI for the node. |
NodeList | getChildNodes()
Return a NodeList that contains all children of this node. |
Object | getFeature(String feature, String version)
Get a feature of this node. |
Node | getFirstChild()
Get first child |
Node | getLastChild()
Get last child |
String | getLocalName()
Get the local name of this node, following the DOM rules |
String | getNamespaceURI()
The namespace URI of this node, or null if it is
unspecified.
|
Node | getNextSibling()
Get next sibling node |
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).
|
String | getNodeValue()
Get the node value (as defined in the DOM).
|
Document | getOwnerDocument()
Return the Document object associated with this node. |
Node | getParentNode()
Find the parent node of this node. |
String | getPrefix()
The namespace prefix of this node, or null if it is
unspecified.
|
Node | getPreviousSibling()
Get the previous sibling of the node |
String | getTextContent()
Get the text content of a node. |
NodeInfo | getUnderlyingNodeInfo()
Get the Saxon NodeInfo object representing this node |
Object | getUserData(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. |
Node | insertBefore(Node newChild, Node refChild)
Insert the node newChild before the existing child node
refChild . |
boolean | isDefaultNamespace(String namespaceURI)
Test whether a particular namespace is the default namespace.
|
boolean | isEqualNode(Node arg)
Compare whether two nodes have the same content. |
boolean | isSameNode(Node other)
Determine whether this is the same node as another node. |
boolean | isSupported(String feature, String version)
Tests whether the DOM implementation implements a specific feature and
that feature is supported by this node. |
String | lookupNamespaceURI(String prefix)
Find the URI corresponding to a given in-scope prefix |
String | lookupPrefix(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. |
Node | removeChild(Node oldChild)
Remove the child node indicated by oldChild from the
list of children, and returns it. |
Node | replaceChild(Node newChild, Node oldChild)
Replace the child node oldChild with
newChild in the list of children, and returns the
oldChild node. |
void | setNodeValue(String nodeValue)
Set the node value. |
void | setPrefix(String prefix)
Set the namespace prefix of this node. |
void | setTextContent(String textContent)
Set the text content of a node. |
Object | setUserData(String key, Object data, UserDataHandler handler)
Set user data. |
static NodeOverNodeInfo | wrap(NodeInfo node)
Factory method to construct a DOM node that wraps an underlying Saxon NodeInfo |
newChild
to the end of the list of children
of this node. Always fails.Parameters: newChild The node to add.
Returns: The node added.
Throws: org.w3c.dom.DOMException
NO_MODIFICATION_ALLOWED_ERR: Always raised.
Parameters: 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
).
Returns: The duplicate node.
Parameters: other the other node.
Returns: Returns how the node is positioned relatively to the reference node.
Throws: org.w3c.dom.DOMException
NamedNodeMap
containing the attributes of this node (if
it is an Element
) or null
otherwise. Note that this
implementation does not treat namespace declarations as attributes.NodeList
that contains all children of this node. If
there are no children, this is a NodeList
containing no
nodes.Parameters: feature the required feature version the version of the required feature
Returns: the value of the feature. Always null in this implementation
Returns: the first child node of this node, or null if it has no children
Returns: last child of this node, or null if it has no children
Returns: The local name of the node. For an element this is the local part of the element name, for an attribute it is the local part of the attribute name. Other node types return null.
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.Since: DOM Level 2
Returns: The next sibling node. Returns null if the current node is the last child of its parent.
Returns: The name of the node. For an element this is the element name, for an attribute it is the attribute name, as a lexical QName. Other node types return conventional names such as "#text" or "#comment"
Document
object associated with this node.Returns: The Node object describing the containing element or root node.
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
.
Since: DOM Level 2
Returns: The previous sibling node. Returns null if the current node is the first child of its parent.
Returns: the string value of the node, or null in the case of document nodes.
Throws: org.w3c.dom.DOMException
Returns: the Saxon NodeInfo object
Parameters: key identifies the user data required
Returns: always null in this implementation
Returns: true
if this node has any attributes,
false
otherwise.
Since: DOM Level 2
Returns: true
if this node has any attributes,
false
otherwise.
newChild
before the existing child node
refChild
. Always fails.Parameters: newChild The node to insert. refChild The reference node, i.e., the node before which the new node must be inserted.
Returns: The node being inserted.
Throws: org.w3c.dom.DOMException NO_MODIFICATION_ALLOWED_ERR: Always raised.
Parameters: namespaceURI the namespace to be tested
Returns: true if this is the default namespace
Parameters: arg The node to be compared. This must wrap a Saxon NodeInfo.
Returns: true if the two nodes are deep-equal.
Returns: true if this Node object and the supplied Node object represent the same node in the tree.
Parameters: 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
.
Returns: Returns true
if the specified feature is supported
on this node, false
otherwise.
Since: DOM Level 2
Parameters: prefix The namespace prefix whose namespace URI is required.
Returns: the corresponding namespace URI, or null if the prefix is not declared.
Parameters: namespaceURI the namespace whose prefix is required
Returns: the corresponding prefix, if there is one, or null if not.
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.Since: DOM Level 2
oldChild
from the
list of children, and returns it. Always fails.Parameters: oldChild The node being removed.
Returns: The node removed.
Throws: org.w3c.dom.DOMException NO_MODIFICATION_ALLOWED_ERR: Always raised.
oldChild
with
newChild
in the list of children, and returns the
oldChild
node. Always fails.Parameters: newChild The new node to put in the child list. oldChild The node being replaced in the list.
Returns: The node replaced.
Throws: org.w3c.dom.DOMException NO_MODIFICATION_ALLOWED_ERR: Always raised.
Parameters: textContent
Throws: org.w3c.dom.DOMException
Parameters: key data handler
Returns: This implementation always throws an exception
Parameters: node the Saxon NodeInfo object
Returns: the DOM wrapper node