Interface Navigator
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
NamedAccessNavigator
- All Known Implementing Classes:
DefaultNavigator, DocumentNavigator, DocumentNavigator, DocumentNavigator, DocumentNavigator, DocumentNavigator
Interface for navigating around an arbitrary object
model, using XPath semantics.
There is a method to obtain a java.util.Iterator,
for each axis specified by XPath. If the target object model
does not support the semantics of a particular axis, an
UnsupportedAxisException is to be thrown. If there are
no nodes on that axis, an empty iterator should be returned.
- Version:
- $Id$
- Author:
- bob mcwhirter, James Strachan
-
Method Summary
Modifier and TypeMethodDescriptiongetAncestorAxisIterator(Object contextNode) Retrieve anIteratormatching theancestorXPath axis.getAncestorOrSelfAxisIterator(Object contextNode) Retrieve anIteratormatching theancestor-or-selfXPath axis.getAttributeAxisIterator(Object contextNode) Retrieve anIteratormatching theattributeXPath axis.getAttributeName(Object attr) Retrieve the local name of the given attribute node.Retrieve the namespace URI of the given attribute node.getAttributeQName(Object attr) Retrieve the qualified name of the given attribute node.Retrieve the string-value of an attribute node.getChildAxisIterator(Object contextNode) Retrieve anIteratormatching thechildXPath axis.getCommentStringValue(Object comment) Retrieve the string-value of a comment node.getDescendantAxisIterator(Object contextNode) Retrieve anIteratormatching thedescendantXPath axis.getDescendantOrSelfAxisIterator(Object contextNode) Retrieve anIteratormatching thedescendant-or-selfXPath axis.getDocument(String uri) Loads a document from the given URIgetDocumentNode(Object contextNode) Returns the document node that contains the given context node.getElementById(Object contextNode, String elementId) Returns the element whose ID is given by elementId.getElementName(Object element) Retrieve the local name of the given element node.getElementNamespaceUri(Object element) Retrieve the namespace URI of the given element node.getElementQName(Object element) Retrieve the qualified name of the given element node.getElementStringValue(Object element) Retrieve the string-value of an element node.getFollowingAxisIterator(Object contextNode) Retrieve anIteratormatching thefollowingXPath axis.getFollowingSiblingAxisIterator(Object contextNode) Retrieve anIteratormatching thefollowing-siblingXPath axis.getNamespaceAxisIterator(Object contextNode) Retrieve anIteratormatching thenamespaceXPath axis.Retrieve the namespace prefix of a namespace node.Retrieve the string-value of a namespace node.shortgetNodeType(Object node) Returns a number that identifies the type of node that the given object represents in this navigator.getParentAxisIterator(Object contextNode) Retrieve anIteratormatching theparentXPath axis.getParentNode(Object contextNode) Returns the parent of the given context node.getPrecedingAxisIterator(Object contextNode) Retrieve anIteratormatching theprecedingXPath axis.getPrecedingSiblingAxisIterator(Object contextNode) Retrieve anIteratormatching thepreceding-siblingXPath axis.Retrieve the data of a processing-instruction.Retrieve the target of a processing-instruction.getSelfAxisIterator(Object contextNode) Retrieve anIteratormatching theselfXPath axis.getTextStringValue(Object text) Retrieve the string-value of a text node.booleanisAttribute(Object object) Returns whether the given object is an attribute node.booleanReturns whether the given object is a comment node.booleanisDocument(Object object) Returns whether the given object is a document node.booleanReturns whether the given object is an element node.booleanisNamespace(Object object) Returns whether the given object is a namespace node.booleanisProcessingInstruction(Object object) Returns whether the given object is a processing-instruction node.booleanReturns whether the given object is a text node.parseXPath(String xpath) Returns a parsed form of the given XPath string, which will be suitable for queries on documents that use the same navigator as this one.translateNamespacePrefixToUri(String prefix, Object element) Translate a namespace prefix to a namespace URI, possibly considering a particular element node.
-
Method Details
-
getChildAxisIterator
Retrieve anIteratormatching thechildXPath axis.- Parameters:
contextNode- the original context node- Returns:
- an Iterator capable of traversing the axis, not null
- Throws:
UnsupportedAxisException- if the semantics of the child axis are not supported by this object model
-
getDescendantAxisIterator
Retrieve anIteratormatching thedescendantXPath axis.- Parameters:
contextNode- the original context node- Returns:
- an Iterator capable of traversing the axis, not null
- Throws:
UnsupportedAxisException- if the semantics of the desscendant axis are not supported by this object model
-
getParentAxisIterator
Retrieve anIteratormatching theparentXPath axis.- Parameters:
contextNode- the original context node- Returns:
- an Iterator capable of traversing the axis, not null
- Throws:
UnsupportedAxisException- if the semantics of the parent axis are not supported by this object model
-
getAncestorAxisIterator
Retrieve anIteratormatching theancestorXPath axis.- Parameters:
contextNode- the original context node- Returns:
- an Iterator capable of traversing the axis, not null
- Throws:
UnsupportedAxisException- if the semantics of the ancestor axis are not supported by this object model
-
getFollowingSiblingAxisIterator
Retrieve anIteratormatching thefollowing-siblingXPath axis.- Parameters:
contextNode- the original context node- Returns:
- an Iterator capable of traversing the axis, not null
- Throws:
UnsupportedAxisException- if the semantics of the following-sibling axis are not supported by this object model
-
getPrecedingSiblingAxisIterator
Retrieve anIteratormatching thepreceding-siblingXPath axis.- Parameters:
contextNode- the original context node- Returns:
- an Iterator capable of traversing the axis, not null
- Throws:
UnsupportedAxisException- if the semantics of the preceding-sibling axis are not supported by this object model
-
getFollowingAxisIterator
Retrieve anIteratormatching thefollowingXPath axis.- Parameters:
contextNode- the original context node- Returns:
- an Iterator capable of traversing the axis, not null
- Throws:
UnsupportedAxisException- if the semantics of the following axis are not supported by this object model
-
getPrecedingAxisIterator
Retrieve anIteratormatching theprecedingXPath axis.- Parameters:
contextNode- the original context node- Returns:
- an Iterator capable of traversing the axis, not null
- Throws:
UnsupportedAxisException- if the semantics of the preceding axis are not supported by this object model
-
getAttributeAxisIterator
Retrieve anIteratormatching theattributeXPath axis.- Parameters:
contextNode- the original context node- Returns:
- an Iterator capable of traversing the axis, not null
- Throws:
UnsupportedAxisException- if the semantics of the attribute axis are not supported by this object model
-
getNamespaceAxisIterator
Retrieve anIteratormatching thenamespaceXPath axis.- Parameters:
contextNode- the original context node- Returns:
- an Iterator capable of traversing the axis, not null
- Throws:
UnsupportedAxisException- if the semantics of the namespace axis are not supported by this object model
-
getSelfAxisIterator
Retrieve anIteratormatching theselfXPath axis.- Parameters:
contextNode- the original context node- Returns:
- an Iterator capable of traversing the axis, not null
- Throws:
UnsupportedAxisException- if the semantics of the self axis are not supported by this object model
-
getDescendantOrSelfAxisIterator
Retrieve anIteratormatching thedescendant-or-selfXPath axis.- Parameters:
contextNode- the original context node- Returns:
- an Iterator capable of traversing the axis, not null
- Throws:
UnsupportedAxisException- if the semantics of the descendant-or-self axis are not supported by this object model
-
getAncestorOrSelfAxisIterator
Retrieve anIteratormatching theancestor-or-selfXPath axis.- Parameters:
contextNode- the original context node- Returns:
- an Iterator capable of traversing the axis, not null
- Throws:
UnsupportedAxisException- if the semantics of the ancestor-or-self axis are not supported by this object model
-
getDocument
Loads a document from the given URI- Parameters:
uri- the URI of the document to load- Returns:
- the document
- Throws:
FunctionCallException- if the document could not be loaded
-
getDocumentNode
-
getParentNode
Returns the parent of the given context node.The parent of any node must either be a document node or an element node.
- Parameters:
contextNode- the context node- Returns:
- the parent of the context node, or null if this is a document node.
- Throws:
UnsupportedAxisException- if the parent axis is not supported by the model- See Also:
-
getElementNamespaceUri
-
getElementName
-
getElementQName
-
getAttributeNamespaceUri
-
getAttributeName
-
getAttributeQName
-
getProcessingInstructionTarget
-
getProcessingInstructionData
-
isDocument
Returns whether the given object is a document node. A document node is the node that is selected by the XPath expression/.- Parameters:
object- the object to test- Returns:
trueif the object is a document node, elsefalse
-
isElement
Returns whether the given object is an element node.- Parameters:
object- the object to test- Returns:
trueif the object is an element node, elsefalse
-
isAttribute
Returns whether the given object is an attribute node.- Parameters:
object- the object to test- Returns:
trueif the object is an attribute node, elsefalse
-
isNamespace
Returns whether the given object is a namespace node.- Parameters:
object- the object to test- Returns:
trueif the object is a namespace node, elsefalse
-
isComment
Returns whether the given object is a comment node.- Parameters:
object- the object to test- Returns:
trueif the object is a comment node, elsefalse
-
isText
Returns whether the given object is a text node.- Parameters:
object- the object to test- Returns:
trueif the object is a text node, elsefalse
-
isProcessingInstruction
Returns whether the given object is a processing-instruction node.- Parameters:
object- the object to test- Returns:
trueif the object is a processing-instruction node, elsefalse
-
getCommentStringValue
-
getElementStringValue
-
getAttributeStringValue
-
getNamespaceStringValue
-
getTextStringValue
-
getNamespacePrefix
-
translateNamespacePrefixToUri
Translate a namespace prefix to a namespace URI, possibly considering a particular element node.Strictly speaking, prefix-to-URI translation should occur irrespective of any element in the document. This method is provided to allow a non-conforming ease-of-use enhancement.
- Parameters:
prefix- the prefix to translateelement- the element to consider during translation- Returns:
- the namespace URI associated with the prefix
- See Also:
-
parseXPath
Returns a parsed form of the given XPath string, which will be suitable for queries on documents that use the same navigator as this one.- Parameters:
xpath- the XPath expression- Returns:
- a new XPath expression object
- Throws:
SAXPathException- if the string is not a syntactically correct XPath expression- See Also:
-
getElementById
Returns the element whose ID is given by elementId. If no such element exists, returns null. Attributes with the name "ID" are not of type ID unless so defined. Implementations that do not know whether attributes are of type ID or not are expected to return null.- Parameters:
contextNode- a node from the document in which to look for the idelementId- id to look for- Returns:
- element whose ID is given by elementId, or null if no such element exists in the document or if the implementation does not know about attribute types
-
getNodeType
Returns a number that identifies the type of node that the given object represents in this navigator.- Parameters:
node- ????- Returns:
- ????
- See Also:
-