Package org.exolab.adaptx.xml.dom2xpn
Class DocumentWrapperXPathNode
java.lang.Object
org.exolab.adaptx.xpath.XPathNode
org.exolab.adaptx.xml.dom2xpn.DocumentWrapperXPathNode
- All Implemented Interfaces:
Serializable
An XPathNode wrapper for DOM Element nodes, used by the
implementation of XPathNode for the W3C DOM API
- Version:
- $Revision: 3830 $ $Date: 2003-09-09 06:44:41 +0200 (Tue, 09 Sep 2003) $
- Author:
- Keith Visco
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionDocumentWrapperXPathNode
(Document document) Creates a new DocumentWrapperXPathNode -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute
(String uri, String local) Returns the value of the named attribute, or null if the node has no such attribute.Returns the first in a list of attribute nodes, or null if the node has no attributes.Returns the first child node of this node, or null if the node has no children.Returns the first in a list of namespace nodes, or null if the node has no namespaces.Returns the local name of the node.getNamespacePrefix
(String uri) Returns the namespace prefix associated with this namespace URI, as defined in the context of this node.Returns the namespace URI the node.getNamespaceURI
(String prefix) Returns the namespace URI associated with this namespace prefix, as defined in the context of this node.getNext()
Returns the next sibling node in document order, or null if this node is the last node.int
Returns the type of this node.Returns the parent node, or null if the node has no parent.Returns the previous sibling node in document order, or null if this node is the first node.Returns the root node.Returns the string value of the node.boolean
Returns true if this node has any child nodes.
-
Constructor Details
-
DocumentWrapperXPathNode
Creates a new DocumentWrapperXPathNode- Parameters:
document
- the Document that this XPathNode wraps. This must not be null.
-
-
Method Details
-
getNodeType
public int getNodeType()Returns the type of this node.- Returns:
- The type of this node
-
getLocalName
Returns the local name of the node. Returns the local name of an element or attribute, the prefix of a namespace node, the target of a processing instruction, or null for all other node types.- Returns:
- The local name of the node, or null if the node has no name
-
getNamespaceURI
Returns the namespace URI the node. Returns the namespace URI of an element, attribute or namespace node, or null for all other node types.- Returns:
- The namespace URI of the node, or null if the node has no namespace URI
-
getRootNode
Returns the root node.- Returns:
- The root node
-
getStringValue
Returns the string value of the node. The string value of a text node or an attribute node is it's text value. The string value of an element or a root node is the concatenation of the string value of all its child nodes. The string value of a namespace node is its namespace URI. The string value of a processing instruction is the instruction, and the string value of a comment is the comment text.- Returns:
- The string value of the node
-
getNamespaceURI
Returns the namespace URI associated with this namespace prefix, as defined in the context of this node. Returns null if the prefix is undefined. Returns empty if the prefix is defined and associated with no namespace. This method is valid only for element nodes.- Parameters:
prefix
- The namespace prefix- Returns:
- The namespace URI, or null
-
getNamespacePrefix
Returns the namespace prefix associated with this namespace URI, as defined in the context of this node. Returns null if no prefix is defined for this namespace URI. Returns an empty string if the default prefix is associated with this namespace URI. This method is valid only for element nodes.- Parameters:
uri
- The namespace URI- Returns:
- The namespace prefix, or null
-
getFirstChild
Returns the first child node of this node, or null if the node has no children. Child nodes are only returned for an element or root node.- Returns:
- The first child node of this node, or null
-
hasChildNodes
public boolean hasChildNodes()Returns true if this node has any child nodes.- Returns:
- True if this node has any child nodes.
-
getNext
Returns the next sibling node in document order, or null if this node is the last node. This method is value for any node except the root node. -
getPrevious
Returns the previous sibling node in document order, or null if this node is the first node. This method can is valid for any node except the root node.- Specified by:
getPrevious
in classXPathNode
- Returns:
- The previous sibling node in document order, or null
-
getFirstAttribute
Returns the first in a list of attribute nodes, or null if the node has no attributes. This method is valid only for the element node.- Specified by:
getFirstAttribute
in classXPathNode
- Returns:
- The first in a list of attribute nodes, or null
-
getAttribute
Returns the value of the named attribute, or null if the node has no such attribute. If the argument uri is null, the node's namespace URI will be used. This method is valid only for the element node.- Specified by:
getAttribute
in classXPathNode
- Parameters:
uri
- The attribute's namespace URI, or nulllocal
- The attribute's local name- Returns:
- The attribute's value, or null if no such attribute exists
-
getFirstNamespace
Returns the first in a list of namespace nodes, or null if the node has no namespaces. This method is valid only for the element node.- Specified by:
getFirstNamespace
in classXPathNode
- Returns:
- The first in a list of namespace nodes, or null
-
getParentNode
Returns the parent node, or null if the node has no parent. This method is valid on all node types except the root node. Attribute and namespace nodes have the element as their parent node.- Specified by:
getParentNode
in classXPathNode
- Returns:
- The parent node, or null
-