Package org.jaxen
Class DefaultNavigator
java.lang.Object
org.jaxen.DefaultNavigator
- All Implemented Interfaces:
Serializable
,Navigator
- Direct Known Subclasses:
DocumentNavigator
,DocumentNavigator
,DocumentNavigator
,DocumentNavigator
Default implementation of
Navigator
.
This implementation is an abstract class, since some required operations cannot be implemented without additional knowledge of the object model.
When possible, default method implementations build upon each other, to reduce the number of methods required to be implemented for each object model. All methods, of course, may be overridden, to provide more-efficient implementations.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAncestorAxisIterator
(Object contextNode) Retrieve anIterator
matching theancestor
XPath axis.getAncestorOrSelfAxisIterator
(Object contextNode) Retrieve anIterator
matching theancestor-or-self
XPath axis.getAttributeAxisIterator
(Object contextNode) ThrowsUnsupportedAxisException
.getChildAxisIterator
(Object contextNode) ThrowsUnsupportedAxisException
getDescendantAxisIterator
(Object contextNode) Retrieve anIterator
matching thedescendant
XPath axis.getDescendantOrSelfAxisIterator
(Object contextNode) Retrieve anIterator
matching thedescendant-or-self
XPath axis.getDocument
(String url) Default implementation that always returns null.getDocumentNode
(Object contextNode) Returns the document node that contains the given context node.getElementById
(Object contextNode, String elementId) Default implementation that cannot find elements.getFollowingAxisIterator
(Object contextNode) Retrieve anIterator
matching thefollowing
XPath axis.getFollowingSiblingAxisIterator
(Object contextNode) Retrieve anIterator
matching thefollowing-sibling
XPath axis.getNamespaceAxisIterator
(Object contextNode) ThrowsUnsupportedAxisException
.short
getNodeType
(Object node) Returns a number that identifies the type of node that the given object represents in this navigator.getParentAxisIterator
(Object contextNode) ThrowsUnsupportedAxisException
getParentNode
(Object contextNode) Default inefficient implementation.getPrecedingAxisIterator
(Object contextNode) Retrieve anIterator
matching thepreceding
XPath axis.getPrecedingSiblingAxisIterator
(Object contextNode) Retrieve anIterator
matching thepreceding-sibling
XPath axis.Retrieve the data of a processing-instruction.Retrieve the target of a processing-instruction.getSelfAxisIterator
(Object contextNode) Retrieve anIterator
matching theself
XPath axis.translateNamespacePrefixToUri
(String prefix, Object element) Translate a namespace prefix to a namespace URI, possibly considering a particular element node.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jaxen.Navigator
getAttributeName, getAttributeNamespaceUri, getAttributeQName, getAttributeStringValue, getCommentStringValue, getElementName, getElementNamespaceUri, getElementQName, getElementStringValue, getNamespacePrefix, getNamespaceStringValue, getTextStringValue, isAttribute, isComment, isDocument, isElement, isNamespace, isProcessingInstruction, isText, parseXPath
-
Constructor Details
-
DefaultNavigator
public DefaultNavigator()
-
-
Method Details
-
getChildAxisIterator
ThrowsUnsupportedAxisException
- Specified by:
getChildAxisIterator
in interfaceNavigator
- Parameters:
contextNode
-- Returns:
- never returns
- Throws:
UnsupportedAxisException
- always
-
getDescendantAxisIterator
Description copied from interface:Navigator
Retrieve anIterator
matching thedescendant
XPath axis.- Specified by:
getDescendantAxisIterator
in interfaceNavigator
- 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
ThrowsUnsupportedAxisException
- Specified by:
getParentAxisIterator
in interfaceNavigator
- Parameters:
contextNode
-- Returns:
- never returns
- Throws:
UnsupportedAxisException
-
getAncestorAxisIterator
Description copied from interface:Navigator
Retrieve anIterator
matching theancestor
XPath axis.- Specified by:
getAncestorAxisIterator
in interfaceNavigator
- 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
Description copied from interface:Navigator
Retrieve anIterator
matching thefollowing-sibling
XPath axis.- Specified by:
getFollowingSiblingAxisIterator
in interfaceNavigator
- 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
Description copied from interface:Navigator
Retrieve anIterator
matching thepreceding-sibling
XPath axis.- Specified by:
getPrecedingSiblingAxisIterator
in interfaceNavigator
- 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
Description copied from interface:Navigator
Retrieve anIterator
matching thefollowing
XPath axis.- Specified by:
getFollowingAxisIterator
in interfaceNavigator
- 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
Description copied from interface:Navigator
Retrieve anIterator
matching thepreceding
XPath axis.- Specified by:
getPrecedingAxisIterator
in interfaceNavigator
- 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
ThrowsUnsupportedAxisException
. Subclasses that support the attribute axis must override this method.- Specified by:
getAttributeAxisIterator
in interfaceNavigator
- Parameters:
contextNode
-- Returns:
- never returns
- Throws:
UnsupportedAxisException
-
getNamespaceAxisIterator
ThrowsUnsupportedAxisException
. Subclasses that support the namespace axis must override this method.- Specified by:
getNamespaceAxisIterator
in interfaceNavigator
- Parameters:
contextNode
-- Returns:
- never returns
- Throws:
UnsupportedAxisException
-
getSelfAxisIterator
Description copied from interface:Navigator
Retrieve anIterator
matching theself
XPath axis.- Specified by:
getSelfAxisIterator
in interfaceNavigator
- 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
Description copied from interface:Navigator
Retrieve anIterator
matching thedescendant-or-self
XPath axis.- Specified by:
getDescendantOrSelfAxisIterator
in interfaceNavigator
- 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
Description copied from interface:Navigator
Retrieve anIterator
matching theancestor-or-self
XPath axis.- Specified by:
getAncestorOrSelfAxisIterator
in interfaceNavigator
- 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
-
getDocumentNode
Description copied from interface:Navigator
Returns the document node that contains the given context node.- Specified by:
getDocumentNode
in interfaceNavigator
- Parameters:
contextNode
- the context node- Returns:
- the document of the context node
- See Also:
-
translateNamespacePrefixToUri
Description copied from interface:Navigator
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.
- Specified by:
translateNamespacePrefixToUri
in interfaceNavigator
- Parameters:
prefix
- the prefix to translateelement
- the element to consider during translation- Returns:
- the namespace URI associated with the prefix
- See Also:
-
getProcessingInstructionTarget
Description copied from interface:Navigator
Retrieve the target of a processing-instruction.- Specified by:
getProcessingInstructionTarget
in interfaceNavigator
- Parameters:
obj
- the context processing-instruction node- Returns:
- the target of the processing-instruction node
-
getProcessingInstructionData
Description copied from interface:Navigator
Retrieve the data of a processing-instruction.- Specified by:
getProcessingInstructionData
in interfaceNavigator
- Parameters:
obj
- the context processing-instruction node- Returns:
- the data of the processing-instruction node
-
getNodeType
Description copied from interface:Navigator
Returns a number that identifies the type of node that the given object represents in this navigator.- Specified by:
getNodeType
in interfaceNavigator
- Parameters:
node
- ????- Returns:
- ????
- See Also:
-
getParentNode
Default inefficient implementation. Subclasses should override this method.- Specified by:
getParentNode
in interfaceNavigator
- Parameters:
contextNode
- the node whose parent to return- Returns:
- the parent node
- Throws:
UnsupportedAxisException
- if the parent axis is not supported- See Also:
-
getDocument
Default implementation that always returns null. Override in subclass if the subclass can load documents.- Specified by:
getDocument
in interfaceNavigator
- Parameters:
url
- the URL of the document to load- Returns:
- null
- Throws:
FunctionCallException
- if an error occurs while loading the URL; e.g. an I/O error or the document is malformed
-
getElementById
Default implementation that cannot find elements. Override in subclass if subclass does know about attribute types.- Specified by:
getElementById
in interfaceNavigator
- Parameters:
contextNode
- a node from the document in which to look for the idelementId
- id to look for- Returns:
- null
-