org.jaxen
Class DefaultNavigator

java.lang.Object
  |
  +--org.jaxen.DefaultNavigator
All Implemented Interfaces:
Navigator, Serializable
Direct Known Subclasses:
DocumentNavigator, DocumentNavigator, DocumentNavigator, DocumentNavigator

public abstract class DefaultNavigator
extends Object
implements Navigator

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:
Serialized Form

Constructor Summary
DefaultNavigator()
           
 
Method Summary
 Iterator getAncestorAxisIterator(Object contextNode)
          Retrieve an Iterator matching the ancestor xpath axis.
 Iterator getAncestorOrSelfAxisIterator(Object contextNode)
          Retrieve an Iterator matching the ancestor-or-self xpath axis.
 Iterator getAttributeAxisIterator(Object contextNode)
          Throws UnsupportedAxisException
 Iterator getChildAxisIterator(Object contextNode)
          Throws UnsupportedAxisException
 Iterator getDescendantAxisIterator(Object contextNode)
          Retrieve an Iterator matching the descendant xpath axis.
 Iterator getDescendantOrSelfAxisIterator(Object contextNode)
          Retrieve an Iterator matching the descendant-or-self xpath axis.
 Object getDocument(String url)
          Loads a document from the given URI
 Object getDocumentNode(Object contextNode)
          Returns the document node that contains the given context node.
 Object getElementById(Object object, String elementId)
          Default implementation that can not find elements.
 Iterator getFollowingAxisIterator(Object contextNode)
          Throws UnsupportedAxisException
 Iterator getFollowingSiblingAxisIterator(Object contextNode)
          Throws UnsupportedAxisException
 Iterator getNamespaceAxisIterator(Object contextNode)
          Throws UnsupportedAxisException
 short getNodeType(Object node)
          Returns a number that identifies the type of node that the given object represents in this navigator.
 Iterator getParentAxisIterator(Object contextNode)
          Throws UnsupportedAxisException
 Object getParentNode(Object contextNode)
          Returns the parent of the given context node.
 Iterator getPrecedingAxisIterator(Object contextNode)
          Throws UnsupportedAxisException
 Iterator getPrecedingSiblingAxisIterator(Object contextNode)
          Throws UnsupportedAxisException
 String getProcessingInstructionData(Object obj)
          Retrieve the data of a processing-instruction.
 String getProcessingInstructionTarget(Object obj)
          Retrieve the target of a processing-instruction.
 Iterator getSelfAxisIterator(Object contextNode)
          Retrieve an Iterator matching the self xpath axis.
 String 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 Detail

DefaultNavigator

public DefaultNavigator()
Method Detail

getChildAxisIterator

public Iterator getChildAxisIterator(Object contextNode)
                              throws UnsupportedAxisException
Throws UnsupportedAxisException
Specified by:
getChildAxisIterator in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
contextNode - The origin context node.
Returns:
An Iterator capable of traversing the axis.
Throws:
UnsupportedAxisException - is the semantics of this axis are not supported by this object model.

getDescendantAxisIterator

public Iterator getDescendantAxisIterator(Object contextNode)
                                   throws UnsupportedAxisException
Description copied from interface: Navigator
Retrieve an Iterator matching the descendant xpath axis.
Specified by:
getDescendantAxisIterator in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
contextNode - The origin context node.
Returns:
An Iterator capable of traversing the axis.
Throws:
UnsupportedAxisException - is the semantics of this axis are not supported by this object model.

getParentAxisIterator

public Iterator getParentAxisIterator(Object contextNode)
                               throws UnsupportedAxisException
Throws UnsupportedAxisException
Specified by:
getParentAxisIterator in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
contextNode - The origin context node.
Returns:
An Iterator capable of traversing the axis.
Throws:
UnsupportedAxisException - is the semantics of this axis are not supported by this object model.

getAncestorAxisIterator

public Iterator getAncestorAxisIterator(Object contextNode)
                                 throws UnsupportedAxisException
Description copied from interface: Navigator
Retrieve an Iterator matching the ancestor xpath axis.
Specified by:
getAncestorAxisIterator in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
contextNode - The origin context node.
Returns:
An Iterator capable of traversing the axis.
Throws:
UnsupportedAxisException - is the semantics of this axis are not supported by this object model.

getFollowingSiblingAxisIterator

public Iterator getFollowingSiblingAxisIterator(Object contextNode)
                                         throws UnsupportedAxisException
Throws UnsupportedAxisException
Specified by:
getFollowingSiblingAxisIterator in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
contextNode - The origin context node.
Returns:
An Iterator capable of traversing the axis.
Throws:
UnsupportedAxisException - is the semantics of this axis are not supported by this object model.

getPrecedingSiblingAxisIterator

public Iterator getPrecedingSiblingAxisIterator(Object contextNode)
                                         throws UnsupportedAxisException
Throws UnsupportedAxisException
Specified by:
getPrecedingSiblingAxisIterator in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
contextNode - The origin context node.
Returns:
An Iterator capable of traversing the axis.
Throws:
UnsupportedAxisException - is the semantics of this axis are not supported by this object model.

getFollowingAxisIterator

public Iterator getFollowingAxisIterator(Object contextNode)
                                  throws UnsupportedAxisException
Throws UnsupportedAxisException
Specified by:
getFollowingAxisIterator in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
contextNode - The origin context node.
Returns:
An Iterator capable of traversing the axis.
Throws:
UnsupportedAxisException - is the semantics of this axis are not supported by this object model.

getPrecedingAxisIterator

public Iterator getPrecedingAxisIterator(Object contextNode)
                                  throws UnsupportedAxisException
Throws UnsupportedAxisException
Specified by:
getPrecedingAxisIterator in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
contextNode - The origin context node.
Returns:
An Iterator capable of traversing the axis.
Throws:
UnsupportedAxisException - is the semantics of this axis are not supported by this object model.

getAttributeAxisIterator

public Iterator getAttributeAxisIterator(Object contextNode)
                                  throws UnsupportedAxisException
Throws UnsupportedAxisException
Specified by:
getAttributeAxisIterator in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
contextNode - The origin context node.
Returns:
An Iterator capable of traversing the axis.
Throws:
UnsupportedAxisException - is the semantics of this axis are not supported by this object model.

getNamespaceAxisIterator

public Iterator getNamespaceAxisIterator(Object contextNode)
                                  throws UnsupportedAxisException
Throws UnsupportedAxisException
Specified by:
getNamespaceAxisIterator in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
contextNode - The origin context node.
Returns:
An Iterator capable of traversing the axis.
Throws:
UnsupportedAxisException - is the semantics of this axis are not supported by this object model.

getSelfAxisIterator

public Iterator getSelfAxisIterator(Object contextNode)
                             throws UnsupportedAxisException
Description copied from interface: Navigator
Retrieve an Iterator matching the self xpath axis.
Specified by:
getSelfAxisIterator in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
contextNode - The origin context node.
Returns:
An Iterator capable of traversing the axis.
Throws:
UnsupportedAxisException - is the semantics of this axis are not supported by this object model.

getDescendantOrSelfAxisIterator

public Iterator getDescendantOrSelfAxisIterator(Object contextNode)
                                         throws UnsupportedAxisException
Description copied from interface: Navigator
Retrieve an Iterator matching the descendant-or-self xpath axis.
Specified by:
getDescendantOrSelfAxisIterator in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
contextNode - The origin context node.
Returns:
An Iterator capable of traversing the axis.
Throws:
UnsupportedAxisException - is the semantics of this axis are not supported by this object model.

getAncestorOrSelfAxisIterator

public Iterator getAncestorOrSelfAxisIterator(Object contextNode)
                                       throws UnsupportedAxisException
Description copied from interface: Navigator
Retrieve an Iterator matching the ancestor-or-self xpath axis.
Specified by:
getAncestorOrSelfAxisIterator in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
contextNode - The origin context node.
Returns:
An Iterator capable of traversing the axis.
Throws:
UnsupportedAxisException - is the semantics of this axis are not supported by this object model.

getDocumentNode

public Object getDocumentNode(Object contextNode)
Description copied from interface: Navigator
Returns the document node that contains the given context node.
Specified by:
getDocumentNode in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
object - The context node.
Returns:
The document of the context node.
See Also:
Navigator.isDocument(Object)

translateNamespacePrefixToUri

public String translateNamespacePrefixToUri(String prefix,
                                            Object element)
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 interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
prefix - The prefix to translate.
element - The element to consider during translation.
Returns:
The namespace URI associated with the prefix.
See Also:
NamespaceContext

getProcessingInstructionTarget

public String getProcessingInstructionTarget(Object obj)
Description copied from interface: Navigator
Retrieve the target of a processing-instruction.
Specified by:
getProcessingInstructionTarget in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
pi - The context processing-instruction node.
Returns:
The target of the processing-instruction node.

getProcessingInstructionData

public String getProcessingInstructionData(Object obj)
Description copied from interface: Navigator
Retrieve the data of a processing-instruction.
Specified by:
getProcessingInstructionData in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
pi - The context processing-instruction node.
Returns:
The data of the processing-instruction node.

getNodeType

public short getNodeType(Object node)
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 interface Navigator
Following copied from interface: org.jaxen.Navigator
See Also:
Pattern

getParentNode

public Object getParentNode(Object contextNode)
                     throws UnsupportedAxisException
Description copied from interface: Navigator
Returns the parent of the given context node.

The parent of any node must either be a document node or an element node.

Specified by:
getParentNode in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
object - The context node.
Returns:
The parent of the context node.
See Also:
Navigator.isDocument(java.lang.Object), Navigator.isElement(java.lang.Object)

getDocument

public Object getDocument(String url)
                   throws FunctionCallException
Description copied from interface: Navigator
Loads a document from the given URI
Specified by:
getDocument in interface Navigator
Following copied from interface: org.jaxen.Navigator
Parameters:
uri - is the URI of the document to load
Throws:
FunctionCallException - if the document could not be loaded

getElementById

public Object getElementById(Object object,
                             String elementId)
Default implementation that can not find elements. Override in subclass if subclass does know about attribute types.
Specified by:
getElementById in interface Navigator
Parameters:
contextNode - a node from the document in which to look for the id
elementId - id to look for
Returns:
null


Copyright © 2002 bob mcwhirter & James Strachan. All Rights Reserved. Hosted by

SourceForge Logo