|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.dom.NodeOverNodeInfo
public abstract class NodeOverNodeInfo
This class implements the DOM Node interface as a wrapper around a Saxon NodeInfo object.
The class provides read-only access to the tree; methods that request updates all fail with an UnsupportedOperationException.
Field Summary | |
---|---|
protected NodeInfo |
node
|
Constructor Summary | |
---|---|
NodeOverNodeInfo()
|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected NodeInfo node
Constructor Detail |
---|
public NodeOverNodeInfo()
Method Detail |
---|
public NodeInfo getUnderlyingNodeInfo()
public static NodeOverNodeInfo wrap(NodeInfo node)
node
- the Saxon NodeInfo object
public final boolean isSameNode(Node other)
isSameNode
in interface Node
public String getBaseURI()
getBaseURI
in interface Node
public String getNodeName()
getNodeName
in interface Node
public String getLocalName()
getLocalName
in interface Node
public boolean hasChildNodes()
hasChildNodes
in interface Node
true
if this node has any attributes,
false
otherwise.public boolean hasAttributes()
hasAttributes
in interface Node
true
if this node has any attributes,
false
otherwise.public short getNodeType()
Type
) are the same as those assigned in the DOM
getNodeType
in interface Node
public Node getParentNode()
getParentNode
in interface Node
public Node getPreviousSibling()
getPreviousSibling
in interface Node
public Node getNextSibling()
getNextSibling
in interface Node
public Node getFirstChild()
getFirstChild
in interface Node
public Node getLastChild()
getLastChild
in interface Node
public String getNodeValue()
getNodeValue
in interface Node
public void setNodeValue(String nodeValue) throws DOMException
setNodeValue
in interface Node
DOMException
public 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 Node
public 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 Node
public Document getOwnerDocument()
Document
object associated with this node.
getOwnerDocument
in interface Node
public Node insertBefore(Node newChild, Node refChild) throws DOMException
newChild
before the existing child node
refChild
. Always fails.
insertBefore
in interface Node
newChild
- The node to insert.refChild
- The reference node, i.e., the node before which the
new node must be inserted.
DOMException
- NO_MODIFICATION_ALLOWED_ERR: Always raised.public Node replaceChild(Node newChild, Node oldChild) throws DOMException
oldChild
with
newChild
in the list of children, and returns the
oldChild
node. Always fails.
replaceChild
in interface Node
newChild
- The new node to put in the child list.oldChild
- The node being replaced in the list.
DOMException
- NO_MODIFICATION_ALLOWED_ERR: Always raised.public Node removeChild(Node oldChild) throws DOMException
oldChild
from the
list of children, and returns it. Always fails.
removeChild
in interface Node
oldChild
- The node being removed.
DOMException
- NO_MODIFICATION_ALLOWED_ERR: Always raised.public Node appendChild(Node newChild) throws DOMException
newChild
to the end of the list of children
of this node. Always fails.
appendChild
in interface Node
newChild
- The node to add.
DOMException
- public Node cloneNode(boolean deep)
cloneNode
in interface 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 Node
public boolean isSupported(String feature, String version)
isSupported
in interface 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 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 Node
public 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 Node
public void setPrefix(String prefix) throws DOMException
setPrefix
in interface Node
DOMException
public short compareDocumentPosition(Node other) throws DOMException
compareDocumentPosition
in interface Node
other
- the other node.
DOMException
public String getTextContent() throws DOMException
getTextContent
in interface Node
DOMException
public void setTextContent(String textContent) throws DOMException
setTextContent
in interface Node
textContent
- the new text content of the node
DOMException
public String lookupPrefix(String namespaceURI)
lookupPrefix
in interface Node
namespaceURI
- the namespace whose prefix is required
public boolean isDefaultNamespace(String namespaceURI)
isDefaultNamespace
in interface Node
namespaceURI
- the namespace to be tested
public String lookupNamespaceURI(String prefix)
lookupNamespaceURI
in interface Node
prefix
- The namespace prefix whose namespace URI is required.
public boolean isEqualNode(Node arg)
isEqualNode
in interface Node
arg
- The node to be compared. This must wrap a Saxon NodeInfo.
public Object getFeature(String feature, String version)
getFeature
in interface Node
feature
- the required featureversion
- the version of the required feature
public Object setUserData(String key, Object data, UserDataHandler handler)
setUserData
in interface Node
key
- name of the user datadata
- value of the user datahandler
- handler for the user data
public Object getUserData(String key)
getUserData
in interface Node
key
- identifies the user data required
protected static void disallowUpdate() throws DOMException
DOMException
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |