Package org.jaxen

Class 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 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 Detail

      • DefaultNavigator

        public DefaultNavigator()
    • Method Detail

      • getDescendantAxisIterator

        public java.util.Iterator getDescendantAxisIterator​(java.lang.Object contextNode)
                                                     throws UnsupportedAxisException
        Retrieve an Iterator matching the descendant XPath axis.
        Specified by:
        getDescendantAxisIterator in interface Navigator
        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
      • getAncestorAxisIterator

        public java.util.Iterator getAncestorAxisIterator​(java.lang.Object contextNode)
                                                   throws UnsupportedAxisException
        Retrieve an Iterator matching the ancestor XPath axis.
        Specified by:
        getAncestorAxisIterator in interface Navigator
        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 UnsupportedAxisException
        Retrieve an Iterator matching the following-sibling XPath axis.
        Specified by:
        getFollowingSiblingAxisIterator in interface Navigator
        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 UnsupportedAxisException
        Retrieve an Iterator matching the preceding-sibling XPath axis.
        Specified by:
        getPrecedingSiblingAxisIterator in interface Navigator
        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 UnsupportedAxisException
        Retrieve an Iterator matching the following XPath axis.
        Specified by:
        getFollowingAxisIterator in interface Navigator
        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 UnsupportedAxisException
        Retrieve an Iterator matching the preceding XPath axis.
        Specified by:
        getPrecedingAxisIterator in interface Navigator
        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 UnsupportedAxisException
        Retrieve an Iterator matching the attribute XPath axis.
        Specified by:
        getAttributeAxisIterator in interface Navigator
        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 UnsupportedAxisException
        Throws UnsupportedAxisException. Subclasses that support the namespace axis must override this method.
        Specified by:
        getNamespaceAxisIterator in interface Navigator
        Parameters:
        contextNode - the node to start from
        Returns:
        never returns
        Throws:
        UnsupportedAxisException - always
      • getSelfAxisIterator

        public java.util.Iterator getSelfAxisIterator​(java.lang.Object contextNode)
                                               throws UnsupportedAxisException
        Retrieve an Iterator matching the self XPath axis.
        Specified by:
        getSelfAxisIterator in interface Navigator
        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 UnsupportedAxisException
        Retrieve an Iterator matching the descendant-or-self XPath axis.
        Specified by:
        getDescendantOrSelfAxisIterator in interface Navigator
        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 UnsupportedAxisException
        Retrieve an Iterator matching the ancestor-or-self XPath axis.
        Specified by:
        getAncestorOrSelfAxisIterator in interface Navigator
        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:
        getDocumentNode in interface Navigator
        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:
        translateNamespacePrefixToUri in interface Navigator
        Parameters:
        contextNode - the node to start from
        prefix - the prefix to translate
        Returns:
        null
        See Also:
        NamespaceContext
      • getProcessingInstructionTarget

        public java.lang.String getProcessingInstructionTarget​(java.lang.Object contextNode)
        Returns null.
        Specified by:
        getProcessingInstructionTarget in interface Navigator
        Parameters:
        contextNode - the node to start from
        Returns:
        null
      • getProcessingInstructionData

        public java.lang.String getProcessingInstructionData​(java.lang.Object contextNode)
        Returns null.
        Specified by:
        getProcessingInstructionData in interface Navigator
        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:
        getNodeType in interface Navigator
        Parameters:
        node - ????
        Returns:
        ????
        See Also:
        Pattern
      • getDocument

        public java.lang.Object getDocument​(java.lang.String url)
                                     throws FunctionCallException
        Default implementation that always returns null. Override in subclass if the subclass can load documents.
        Specified by:
        getDocument in interface Navigator
        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:
        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