Package net.sf.saxon.dom
Class NodeOverNodeInfo
- java.lang.Object
- 
- net.sf.saxon.dom.NodeOverNodeInfo
 
- 
- All Implemented Interfaces:
- org.w3c.dom.Node
 - Direct Known Subclasses:
- AttrOverNodeInfo,- DocumentOverNodeInfo,- ElementOverNodeInfo,- PIOverNodeInfo,- TextOverNodeInfo
 
 public abstract class NodeOverNodeInfo extends java.lang.Object implements org.w3c.dom.NodeThis 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 SummaryFields Modifier and Type Field Description protected NodeInfonode- 
Fields inherited from interface org.w3c.dom.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
 
- 
 - 
Constructor SummaryConstructors Constructor Description NodeOverNodeInfo()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.w3c.dom.NodeappendChild(org.w3c.dom.Node newChild)Adds the nodenewChildto the end of the list of children of this node.org.w3c.dom.NodecloneNode(boolean deep)Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.shortcompareDocumentPosition(org.w3c.dom.Node other)Compare the position of the (other) node in document order with the reference node (this node).protected static voiddisallowUpdate()Internal method used to indicate that update operations are not allowedbooleanequals(java.lang.Object obj)The equals() method returns true for two Node objects that represent the same conceptual DOM Node.org.w3c.dom.NamedNodeMapgetAttributes()Return aNamedNodeMapcontaining the attributes of this node (if it is anElement) ornullotherwise.java.lang.StringgetBaseURI()Get the base URI for the node.org.w3c.dom.NodeListgetChildNodes()Return aNodeListthat contains all children of this node.java.lang.ObjectgetFeature(java.lang.String feature, java.lang.String version)Get a feature of this node.org.w3c.dom.NodegetFirstChild()Get first childorg.w3c.dom.NodegetLastChild()Get last childjava.lang.StringgetLocalName()Get the local name of this node, following the DOM rulesjava.lang.StringgetNamespaceURI()The namespace URI of this node, ornullif it is unspecified.org.w3c.dom.NodegetNextSibling()Get next sibling nodejava.lang.StringgetNodeName()Get the name of this node, following the DOM rulesshortgetNodeType()Get the type of this node (node kind, in XPath terminology).java.lang.StringgetNodeValue()Get the node value (as defined in the DOM).org.w3c.dom.DocumentgetOwnerDocument()Return theDocumentobject associated with this node.org.w3c.dom.NodegetParentNode()Find the parent node of this node.java.lang.StringgetPrefix()The namespace prefix of this node, ornullif it is unspecified.org.w3c.dom.NodegetPreviousSibling()Get the previous sibling of the nodejava.lang.StringgetTextContent()Get the text content of a node.NodeInfogetUnderlyingNodeInfo()Get the Saxon NodeInfo object representing this nodejava.lang.ObjectgetUserData(java.lang.String key)Get user data associated with this node.booleanhasAttributes()Returns whether this node has any attributes.booleanhasChildNodes()Determine whether the node has any children.inthashCode()Return a hashCodeorg.w3c.dom.NodeinsertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)Insert the nodenewChildbefore the existing child noderefChild.booleanisDefaultNamespace(java.lang.String namespaceURI)Test whether a particular namespace is the default namespace.booleanisEqualNode(org.w3c.dom.Node arg)Compare whether two nodes have the same content.booleanisSameNode(org.w3c.dom.Node other)Determine whether this is the same node as another node.booleanisSupported(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.StringlookupNamespaceURI(java.lang.String prefix)Find the URI corresponding to a given in-scope prefixjava.lang.StringlookupPrefix(java.lang.String namespaceURI)Get the (first) prefix assigned to a specified namespace URI, or null if the namespace is not in scope.voidnormalize()Puts allTextnodes in the full depth of the sub-tree underneath thisNode, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separatesTextnodes, i.e., there are neither adjacentTextnodes nor emptyTextnodes.org.w3c.dom.NoderemoveChild(org.w3c.dom.Node oldChild)Remove the child node indicated byoldChildfrom the list of children, and returns it.org.w3c.dom.NodereplaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)Replace the child nodeoldChildwithnewChildin the list of children, and returns theoldChildnode.voidsetNodeValue(java.lang.String nodeValue)Set the node value.voidsetPrefix(java.lang.String prefix)Set the namespace prefix of this node.voidsetTextContent(java.lang.String textContent)Set the text content of a node.java.lang.ObjectsetUserData(java.lang.String key, java.lang.Object data, org.w3c.dom.UserDataHandler handler)Set user data.static NodeOverNodeInfowrap(NodeInfo node)Factory method to construct a DOM node that wraps an underlying Saxon NodeInfo
 
- 
- 
- 
Field Detail- 
nodeprotected NodeInfo node 
 
- 
 - 
Method Detail- 
getUnderlyingNodeInfopublic NodeInfo getUnderlyingNodeInfo() Get the Saxon NodeInfo object representing this node- Returns:
- the Saxon NodeInfo object
 
 - 
wrappublic static NodeOverNodeInfo wrap(NodeInfo node) Factory method to construct a DOM node that wraps an underlying Saxon NodeInfo- Parameters:
- node- the Saxon NodeInfo object
- Returns:
- the DOM wrapper node
 
 - 
isSameNodepublic final boolean isSameNode(org.w3c.dom.Node other) Determine whether this is the same node as another node. DOM Level 3 method.- Specified by:
- isSameNodein interface- org.w3c.dom.Node
- Returns:
- true if this Node object and the supplied Node object represent the same node in the tree.
 
 - 
equalspublic boolean equals(java.lang.Object obj) The equals() method returns true for two Node objects that represent the same conceptual DOM Node. This is a concession to the Xalan IdentityTransformer, which relies on equals() for DOM Nodes having this behaviour, even though it is not defined in the specification- Overrides:
- equalsin class- java.lang.Object
- Parameters:
- obj- the object to be compared
- Returns:
- if this node and obj represent the same conceptual DOM node. That is, return true if isSameNode((Node)obj) returns true
 
 - 
hashCodepublic int hashCode() Return a hashCode- Overrides:
- hashCodein class- java.lang.Object
- Returns:
- a hashCode such that two wrappers over the same underlying node have the same hashCode.
 
 - 
getBaseURIpublic java.lang.String getBaseURI() Get the base URI for the node. Default implementation for child nodes gets the base URI of the parent node.- Specified by:
- getBaseURIin interface- org.w3c.dom.Node
 
 - 
getNodeNamepublic java.lang.String getNodeName() Get the name of this node, following the DOM rules- Specified by:
- getNodeNamein interface- org.w3c.dom.Node
- 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"
 
 - 
getLocalNamepublic java.lang.String getLocalName() Get the local name of this node, following the DOM rules- Specified by:
- getLocalNamein interface- org.w3c.dom.Node
- 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.
 
 - 
hasChildNodespublic boolean hasChildNodes() Determine whether the node has any children.- Specified by:
- hasChildNodesin interface- org.w3c.dom.Node
- Returns:
- trueif this node has any attributes,- falseotherwise.
 
 - 
hasAttributespublic boolean hasAttributes() Returns whether this node has any attributes. We treat the declaration of the XML namespace as being present on every element, and since namespace declarations are treated as attributes, every element has at least one attribute. This method therefore returns true.- Specified by:
- hasAttributesin interface- org.w3c.dom.Node
- Returns:
- trueif this node has any attributes,- falseotherwise.
- Since:
- DOM Level 2
 
 - 
getNodeTypepublic short getNodeType() Get the type of this node (node kind, in XPath terminology). Note, the numbers assigned to node kinds in Saxon (seeType) are the same as those assigned in the DOM- Specified by:
- getNodeTypein interface- org.w3c.dom.Node
 
 - 
getParentNodepublic org.w3c.dom.Node getParentNode() Find the parent node of this node.- Specified by:
- getParentNodein interface- org.w3c.dom.Node
- Returns:
- The Node object describing the containing element or root node.
 
 - 
getPreviousSiblingpublic org.w3c.dom.Node getPreviousSibling() Get the previous sibling of the node- Specified by:
- getPreviousSiblingin interface- org.w3c.dom.Node
- Returns:
- The previous sibling node. Returns null if the current node is the first child of its parent.
 
 - 
getNextSiblingpublic org.w3c.dom.Node getNextSibling() Get next sibling node- Specified by:
- getNextSiblingin interface- org.w3c.dom.Node
- Returns:
- The next sibling node. Returns null if the current node is the last child of its parent.
 
 - 
getFirstChildpublic org.w3c.dom.Node getFirstChild() Get first child- Specified by:
- getFirstChildin interface- org.w3c.dom.Node
- Returns:
- the first child node of this node, or null if it has no children
 
 - 
getLastChildpublic org.w3c.dom.Node getLastChild() Get last child- Specified by:
- getLastChildin interface- org.w3c.dom.Node
- Returns:
- last child of this node, or null if it has no children
 
 - 
getNodeValuepublic java.lang.String getNodeValue() Get the node value (as defined in the DOM). This is not generally the same as the XPath string-value: in particular, the node value of an element node is null.- Specified by:
- getNodeValuein interface- org.w3c.dom.Node
 
 - 
setNodeValuepublic void setNodeValue(java.lang.String nodeValue) throws org.w3c.dom.DOMExceptionSet the node value. Always fails- Specified by:
- setNodeValuein interface- org.w3c.dom.Node
- Throws:
- org.w3c.dom.DOMException
 
 - 
getChildNodespublic org.w3c.dom.NodeList getChildNodes() Return aNodeListthat contains all children of this node. If there are no children, this is aNodeListcontaining no nodes.- Specified by:
- getChildNodesin interface- org.w3c.dom.Node
 
 - 
getAttributespublic org.w3c.dom.NamedNodeMap getAttributes() Return aNamedNodeMapcontaining the attributes of this node (if it is anElement) ornullotherwise.- Specified by:
- getAttributesin interface- org.w3c.dom.Node
 
 - 
getOwnerDocumentpublic org.w3c.dom.Document getOwnerDocument() Return theDocumentobject associated with this node.- Specified by:
- getOwnerDocumentin interface- org.w3c.dom.Node
 
 - 
insertBeforepublic org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild) throws org.w3c.dom.DOMExceptionInsert the nodenewChildbefore the existing child noderefChild. Always fails.- Specified by:
- insertBeforein interface- org.w3c.dom.Node
- 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.
 
 - 
replaceChildpublic org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild) throws org.w3c.dom.DOMExceptionReplace the child nodeoldChildwithnewChildin the list of children, and returns theoldChildnode. Always fails.- Specified by:
- replaceChildin interface- org.w3c.dom.Node
- 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.
 
 - 
removeChildpublic org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild) throws org.w3c.dom.DOMExceptionRemove the child node indicated byoldChildfrom the list of children, and returns it. Always fails.- Specified by:
- removeChildin interface- org.w3c.dom.Node
- Parameters:
- oldChild- The node being removed.
- Returns:
- The node removed.
- Throws:
- org.w3c.dom.DOMException- NO_MODIFICATION_ALLOWED_ERR: Always raised.
 
 - 
appendChildpublic org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild) throws org.w3c.dom.DOMExceptionAdds the nodenewChildto the end of the list of children of this node. Always fails.- Specified by:
- appendChildin interface- org.w3c.dom.Node
- Parameters:
- newChild- The node to add.
- Returns:
- The node added.
- Throws:
- org.w3c.dom.DOMException-
 NO_MODIFICATION_ALLOWED_ERR: Always raised.
 
 - 
cloneNodepublic org.w3c.dom.Node cloneNode(boolean deep) Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. Always fails.- Specified by:
- cloneNodein interface- org.w3c.dom.Node
- 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.
 
 - 
normalizepublic void normalize() Puts allTextnodes in the full depth of the sub-tree underneath thisNode, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separatesTextnodes, i.e., there are neither adjacentTextnodes nor emptyTextnodes.- Specified by:
- normalizein interface- org.w3c.dom.Node
- Since:
- DOM Level 2
 
 - 
isSupportedpublic 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.- Specified by:
- isSupportedin interface- org.w3c.dom.Node
- Parameters:
- feature- The name of the feature to test. This is the same name which can be passed to the method- hasFeatureon- 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 trueif the specified feature is supported on this node,falseotherwise.
- Since:
- DOM Level 2
 
 - 
getNamespaceURIpublic java.lang.String getNamespaceURI() The namespace URI of this node, ornullif it is unspecified.
 This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.
 For nodes of any type other thanELEMENT_NODEandATTRIBUTE_NODEand nodes created with a DOM Level 1 method, such ascreateElementfrom theDocumentinterface, this is alwaysnull. 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.- Specified by:
- getNamespaceURIin interface- org.w3c.dom.Node
- Since:
- DOM Level 2
 
 - 
getPrefixpublic java.lang.String getPrefix() The namespace prefix of this node, ornullif it is unspecified.
 For nodes of any type other thanELEMENT_NODEandATTRIBUTE_NODEand nodes created with a DOM Level 1 method, such ascreateElementfrom theDocumentinterface, this is alwaysnull.- Specified by:
- getPrefixin interface- org.w3c.dom.Node
- Since:
- DOM Level 2
 
 - 
setPrefixpublic void setPrefix(java.lang.String prefix) throws org.w3c.dom.DOMExceptionSet the namespace prefix of this node. Always fails.- Specified by:
- setPrefixin interface- org.w3c.dom.Node
- Throws:
- org.w3c.dom.DOMException
 
 - 
compareDocumentPositionpublic short compareDocumentPosition(org.w3c.dom.Node other) throws org.w3c.dom.DOMExceptionCompare the position of the (other) node in document order with the reference node (this node). DOM Level 3 method.- Specified by:
- compareDocumentPositionin interface- org.w3c.dom.Node
- Parameters:
- other- the other node.
- Returns:
- Returns how the node is positioned relatively to the reference node.
- Throws:
- org.w3c.dom.DOMException- if an error occurs
 
 - 
getTextContentpublic java.lang.String getTextContent() throws org.w3c.dom.DOMExceptionGet the text content of a node. This is a DOM Level 3 method. The definition is the same as the definition of the string value of a node in XPath, except in the case of document nodes.- Specified by:
- getTextContentin interface- org.w3c.dom.Node
- Returns:
- the string value of the node, or null in the case of document nodes.
- Throws:
- org.w3c.dom.DOMException- if a dynamic error occurs
 
 - 
setTextContentpublic void setTextContent(java.lang.String textContent) throws java.lang.UnsupportedOperationExceptionSet the text content of a node. Always fails.- Specified by:
- setTextContentin interface- org.w3c.dom.Node
- Parameters:
- textContent- the new text content of the node
- Throws:
- java.lang.UnsupportedOperationException- always
 
 - 
lookupPrefixpublic 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. DOM Level 3 method.- Specified by:
- lookupPrefixin interface- org.w3c.dom.Node
- Parameters:
- namespaceURI- the namespace whose prefix is required
- Returns:
- the corresponding prefix, if there is one, or null if not.
 
 - 
isDefaultNamespacepublic boolean isDefaultNamespace(java.lang.String namespaceURI) Test whether a particular namespace is the default namespace. DOM Level 3 method.- Specified by:
- isDefaultNamespacein interface- org.w3c.dom.Node
- Parameters:
- namespaceURI- the namespace to be tested
- Returns:
- true if this is the default namespace
 
 - 
lookupNamespaceURIpublic java.lang.String lookupNamespaceURI(java.lang.String prefix) Find the URI corresponding to a given in-scope prefix- Specified by:
- lookupNamespaceURIin interface- org.w3c.dom.Node
- Parameters:
- prefix- The namespace prefix whose namespace URI is required.
- Returns:
- the corresponding namespace URI, or null if the prefix is not declared.
 
 - 
isEqualNodepublic boolean isEqualNode(org.w3c.dom.Node arg) Compare whether two nodes have the same content. This is a DOM Level 3 method.- Specified by:
- isEqualNodein interface- org.w3c.dom.Node
- Parameters:
- arg- The node to be compared. This must wrap a Saxon NodeInfo.
- Returns:
- true if the two nodes are deep-equal.
 
 - 
getFeaturepublic java.lang.Object getFeature(java.lang.String feature, java.lang.String version)Get a feature of this node. DOM Level 3 method, always returns null.- Specified by:
- getFeaturein interface- org.w3c.dom.Node
- Parameters:
- feature- the required feature
- version- the version of the required feature
- Returns:
- the value of the feature. Always null in this implementation
 
 - 
setUserDatapublic java.lang.Object setUserData(java.lang.String key, java.lang.Object data, org.w3c.dom.UserDataHandler handler)Set user data. Always throws UnsupportedOperationException in this implementation- Specified by:
- setUserDatain interface- org.w3c.dom.Node
- Parameters:
- key- name of the user data
- data- value of the user data
- handler- handler for the user data
- Returns:
- This implementation always throws an exception
 
 - 
getUserDatapublic java.lang.Object getUserData(java.lang.String key) Get user data associated with this node. DOM Level 3 method, always returns null in this implementation- Specified by:
- getUserDatain interface- org.w3c.dom.Node
- Parameters:
- key- identifies the user data required
- Returns:
- always null in this implementation
 
 - 
disallowUpdateprotected static void disallowUpdate() throws org.w3c.dom.DOMExceptionInternal method used to indicate that update operations are not allowed- Throws:
- org.w3c.dom.DOMException- always, to indicate that update is not supported in this DOM implementation
 
 
- 
 
-