Package org.jaxen
Class DefaultNavigator
- java.lang.Object
-
- org.jaxen.DefaultNavigator
-
- All Implemented Interfaces:
java.io.Serializable,Navigator
- Direct Known Subclasses:
DocumentNavigator,DocumentNavigator,DocumentNavigator,DocumentNavigator,DocumentNavigator
public abstract class DefaultNavigator extends java.lang.Object implements Navigator
Default implementation ofNavigator.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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultNavigator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.IteratorgetAncestorAxisIterator(java.lang.Object contextNode)Retrieve anIteratormatching theancestorXPath axis.java.util.IteratorgetAncestorOrSelfAxisIterator(java.lang.Object contextNode)Retrieve anIteratormatching theancestor-or-selfXPath axis.java.util.IteratorgetAttributeAxisIterator(java.lang.Object contextNode)Retrieve anIteratormatching theattributeXPath axis.java.util.IteratorgetChildAxisIterator(java.lang.Object contextNode)ThrowsUnsupportedAxisException.java.util.IteratorgetDescendantAxisIterator(java.lang.Object contextNode)Retrieve anIteratormatching thedescendantXPath axis.java.util.IteratorgetDescendantOrSelfAxisIterator(java.lang.Object contextNode)Retrieve anIteratormatching thedescendant-or-selfXPath axis.java.lang.ObjectgetDocument(java.lang.String url)Default implementation that always returns null.java.lang.ObjectgetDocumentNode(java.lang.Object contextNode)Returns null.java.lang.ObjectgetElementById(java.lang.Object contextNode, java.lang.String elementId)Default implementation that cannot find elements.java.util.IteratorgetFollowingAxisIterator(java.lang.Object contextNode)Retrieve anIteratormatching thefollowingXPath axis.java.util.IteratorgetFollowingSiblingAxisIterator(java.lang.Object contextNode)Retrieve anIteratormatching thefollowing-siblingXPath axis.java.util.IteratorgetNamespaceAxisIterator(java.lang.Object contextNode)ThrowsUnsupportedAxisException.shortgetNodeType(java.lang.Object node)Returns a number that identifies the type of node that the given object represents in this navigator.java.util.IteratorgetParentAxisIterator(java.lang.Object contextNode)ThrowsUnsupportedAxisException.java.lang.ObjectgetParentNode(java.lang.Object contextNode)Default inefficient implementation.java.util.IteratorgetPrecedingAxisIterator(java.lang.Object contextNode)Retrieve anIteratormatching theprecedingXPath axis.java.util.IteratorgetPrecedingSiblingAxisIterator(java.lang.Object contextNode)Retrieve anIteratormatching thepreceding-siblingXPath axis.java.lang.StringgetProcessingInstructionData(java.lang.Object contextNode)Returns null.java.lang.StringgetProcessingInstructionTarget(java.lang.Object contextNode)Returns null.java.util.IteratorgetSelfAxisIterator(java.lang.Object contextNode)Retrieve anIteratormatching theselfXPath axis.java.lang.StringtranslateNamespacePrefixToUri(java.lang.String prefix, java.lang.Object contextNode)Returns null.-
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
-
-
-
-
Method Detail
-
getChildAxisIterator
public java.util.Iterator getChildAxisIterator(java.lang.Object contextNode) throws UnsupportedAxisExceptionThrowsUnsupportedAxisException. Subclasses should override this method.- Specified by:
getChildAxisIteratorin interfaceNavigator- Parameters:
contextNode- the node to start from- Returns:
- never returns
- Throws:
UnsupportedAxisException- always
-
getDescendantAxisIterator
public java.util.Iterator getDescendantAxisIterator(java.lang.Object contextNode) throws UnsupportedAxisExceptionRetrieve 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
public java.util.Iterator getParentAxisIterator(java.lang.Object contextNode) throws UnsupportedAxisExceptionThrowsUnsupportedAxisException. Subclasses should override this method.- Specified by:
getParentAxisIteratorin interfaceNavigator- Parameters:
contextNode- the node to start from- Returns:
- never returns
- Throws:
UnsupportedAxisException- always
-
getAncestorAxisIterator
public java.util.Iterator getAncestorAxisIterator(java.lang.Object contextNode) throws UnsupportedAxisExceptionRetrieve 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
public java.util.Iterator getFollowingSiblingAxisIterator(java.lang.Object contextNode) throws UnsupportedAxisExceptionRetrieve 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
public java.util.Iterator getPrecedingSiblingAxisIterator(java.lang.Object contextNode) throws UnsupportedAxisExceptionRetrieve 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
public java.util.Iterator getFollowingAxisIterator(java.lang.Object contextNode) throws UnsupportedAxisExceptionRetrieve 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
public java.util.Iterator getPrecedingAxisIterator(java.lang.Object contextNode) throws UnsupportedAxisExceptionRetrieve 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
public java.util.Iterator getAttributeAxisIterator(java.lang.Object contextNode) throws UnsupportedAxisExceptionRetrieve 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
public java.util.Iterator getNamespaceAxisIterator(java.lang.Object contextNode) throws UnsupportedAxisExceptionThrowsUnsupportedAxisException. 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
public java.util.Iterator getSelfAxisIterator(java.lang.Object contextNode) throws UnsupportedAxisExceptionRetrieve 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
public java.util.Iterator getDescendantOrSelfAxisIterator(java.lang.Object contextNode) throws UnsupportedAxisExceptionRetrieve 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
public java.util.Iterator getAncestorOrSelfAxisIterator(java.lang.Object contextNode) throws UnsupportedAxisExceptionRetrieve 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
public java.lang.Object getDocumentNode(java.lang.Object contextNode)
Returns null.- Specified by:
getDocumentNodein interfaceNavigator- Parameters:
contextNode- the node to start from- Returns:
- null
- See Also:
Navigator.isDocument(Object)
-
translateNamespacePrefixToUri
public java.lang.String translateNamespacePrefixToUri(java.lang.String prefix, java.lang.Object contextNode)Returns null.- Specified by:
translateNamespacePrefixToUriin interfaceNavigator- Parameters:
contextNode- the node to start fromprefix- the prefix to translate- Returns:
- null
- See Also:
NamespaceContext
-
getProcessingInstructionTarget
public java.lang.String getProcessingInstructionTarget(java.lang.Object contextNode)
Returns null.- Specified by:
getProcessingInstructionTargetin interfaceNavigator- Parameters:
contextNode- the node to start from- Returns:
- null
-
getProcessingInstructionData
public java.lang.String getProcessingInstructionData(java.lang.Object contextNode)
Returns null.- Specified by:
getProcessingInstructionDatain interfaceNavigator- Parameters:
contextNode- the node to start from- Returns:
- null
-
getNodeType
public short getNodeType(java.lang.Object node)
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:
Pattern
-
getParentNode
public java.lang.Object getParentNode(java.lang.Object contextNode) throws UnsupportedAxisExceptionDefault 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:
Navigator.isDocument(java.lang.Object),Navigator.isElement(java.lang.Object)
-
getDocument
public java.lang.Object getDocument(java.lang.String url) throws FunctionCallExceptionDefault 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
public java.lang.Object getElementById(java.lang.Object contextNode, java.lang.String elementId)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
-
-