Class DefaultNavigator
java.lang.Object
org.jaxen.DefaultNavigator
- All Implemented Interfaces:
Serializable, Navigator
- Direct Known Subclasses:
DocumentNavigator, 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.
- Author:
- bob mcwhirter (bob@werken.com), Erwin Bolwidt (ejb@klomp.org)
- See Also:
-
Constructor Summary
Constructors -
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.getChildAxisIterator(Object contextNode) ThrowsUnsupportedAxisException.getDescendantAxisIterator(Object contextNode) Retrieve anIteratormatching thedescendantXPath axis.getDescendantOrSelfAxisIterator(Object contextNode) Retrieve anIteratormatching thedescendant-or-selfXPath axis.getDocument(String url) Default implementation that always returns null.getDocumentNode(Object contextNode) Returns null.getElementById(Object contextNode, String elementId) Default implementation that cannot find elements.getFollowingAxisIterator(Object contextNode) Retrieve anIteratormatching thefollowingXPath axis.getFollowingSiblingAxisIterator(Object contextNode) Retrieve anIteratormatching thefollowing-siblingXPath axis.getNamespaceAxisIterator(Object contextNode) ThrowsUnsupportedAxisException.shortgetNodeType(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 anIteratormatching theprecedingXPath axis.getPrecedingSiblingAxisIterator(Object contextNode) Retrieve anIteratormatching thepreceding-siblingXPath axis.getProcessingInstructionData(Object contextNode) Returns null.getProcessingInstructionTarget(Object contextNode) Returns null.getSelfAxisIterator(Object contextNode) Retrieve anIteratormatching theselfXPath axis.translateNamespacePrefixToUri(String prefix, Object contextNode) Returns null.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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. Subclasses should override this method.- Specified by:
getChildAxisIteratorin interfaceNavigator- Parameters:
contextNode- the node to start from- Returns:
- never returns
- Throws:
UnsupportedAxisException- always
-
getDescendantAxisIterator
Retrieve anIteratormatching thedescendantXPath axis.- Specified by:
getDescendantAxisIteratorin 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. Subclasses should override this method.- Specified by:
getParentAxisIteratorin interfaceNavigator- Parameters:
contextNode- the node to start from- Returns:
- never returns
- Throws:
UnsupportedAxisException- always
-
getAncestorAxisIterator
Retrieve anIteratormatching theancestorXPath axis.- Specified by:
getAncestorAxisIteratorin 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
Retrieve anIteratormatching thefollowing-siblingXPath axis.- Specified by:
getFollowingSiblingAxisIteratorin 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
Retrieve anIteratormatching thepreceding-siblingXPath axis.- Specified by:
getPrecedingSiblingAxisIteratorin 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
Retrieve anIteratormatching thefollowingXPath axis.- Specified by:
getFollowingAxisIteratorin 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
Retrieve anIteratormatching theprecedingXPath axis.- Specified by:
getPrecedingAxisIteratorin 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
Retrieve anIteratormatching theattributeXPath axis.- Specified by:
getAttributeAxisIteratorin interfaceNavigator- 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
ThrowsUnsupportedAxisException. Subclasses that support the namespace axis must override this method.- Specified by:
getNamespaceAxisIteratorin interfaceNavigator- Parameters:
contextNode- the node to start from- Returns:
- never returns
- Throws:
UnsupportedAxisException- always
-
getSelfAxisIterator
Retrieve anIteratormatching theselfXPath axis.- Specified by:
getSelfAxisIteratorin 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
Retrieve anIteratormatching thedescendant-or-selfXPath axis.- Specified by:
getDescendantOrSelfAxisIteratorin 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
Retrieve anIteratormatching theancestor-or-selfXPath axis.- Specified by:
getAncestorOrSelfAxisIteratorin 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
Returns null.- Specified by:
getDocumentNodein interfaceNavigator- Parameters:
contextNode- the node to start from- Returns:
- null
- See Also:
-
translateNamespacePrefixToUri
Returns null.- Specified by:
translateNamespacePrefixToUriin interfaceNavigator- Parameters:
prefix- the prefix to translatecontextNode- the node to start from- Returns:
- null
- See Also:
-
getProcessingInstructionTarget
Returns null.- Specified by:
getProcessingInstructionTargetin interfaceNavigator- Parameters:
contextNode- the node to start from- Returns:
- null
-
getProcessingInstructionData
Returns null.- Specified by:
getProcessingInstructionDatain interfaceNavigator- Parameters:
contextNode- the node to start from- Returns:
- null
-
getNodeType
Returns a number that identifies the type of node that the given object represents in this navigator.- Specified by:
getNodeTypein interfaceNavigator- Parameters:
node- ????- Returns:
- ????
- See Also:
-
getParentNode
Default inefficient implementation. Subclasses should override this method.- Specified by:
getParentNodein 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:
getDocumentin 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 knows about attribute types.- Specified by:
getElementByIdin interfaceNavigator- Parameters:
contextNode- a node from the document in which to look for the idelementId- id to look for- Returns:
- null
-