Package org.jaxen

Interface Navigator

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Iterator getAncestorAxisIterator​(java.lang.Object contextNode)
      Retrieve an Iterator matching the ancestor XPath axis.
      java.util.Iterator getAncestorOrSelfAxisIterator​(java.lang.Object contextNode)
      Retrieve an Iterator matching the ancestor-or-self XPath axis.
      java.util.Iterator getAttributeAxisIterator​(java.lang.Object contextNode)
      Retrieve an Iterator matching the attribute XPath axis.
      java.lang.String getAttributeName​(java.lang.Object attr)
      Retrieve the local name of the given attribute node.
      java.lang.String getAttributeNamespaceUri​(java.lang.Object attr)
      Retrieve the namespace URI of the given attribute node.
      java.lang.String getAttributeQName​(java.lang.Object attr)
      Retrieve the qualified name of the given attribute node.
      java.lang.String getAttributeStringValue​(java.lang.Object attr)
      Retrieve the string-value of an attribute node.
      java.util.Iterator getChildAxisIterator​(java.lang.Object contextNode)
      Retrieve an Iterator matching the child XPath axis.
      java.lang.String getCommentStringValue​(java.lang.Object comment)
      Retrieve the string-value of a comment node.
      java.util.Iterator getDescendantAxisIterator​(java.lang.Object contextNode)
      Retrieve an Iterator matching the descendant XPath axis.
      java.util.Iterator getDescendantOrSelfAxisIterator​(java.lang.Object contextNode)
      Retrieve an Iterator matching the descendant-or-self XPath axis.
      java.lang.Object getDocument​(java.lang.String uri)
      Loads a document from the given URI
      java.lang.Object getDocumentNode​(java.lang.Object contextNode)
      Returns the document node that contains the given context node.
      java.lang.Object getElementById​(java.lang.Object contextNode, java.lang.String elementId)
      Returns the element whose ID is given by elementId.
      java.lang.String getElementName​(java.lang.Object element)
      Retrieve the local name of the given element node.
      java.lang.String getElementNamespaceUri​(java.lang.Object element)
      Retrieve the namespace URI of the given element node.
      java.lang.String getElementQName​(java.lang.Object element)
      Retrieve the qualified name of the given element node.
      java.lang.String getElementStringValue​(java.lang.Object element)
      Retrieve the string-value of an element node.
      java.util.Iterator getFollowingAxisIterator​(java.lang.Object contextNode)
      Retrieve an Iterator matching the following XPath axis.
      java.util.Iterator getFollowingSiblingAxisIterator​(java.lang.Object contextNode)
      Retrieve an Iterator matching the following-sibling XPath axis.
      java.util.Iterator getNamespaceAxisIterator​(java.lang.Object contextNode)
      Retrieve an Iterator matching the namespace XPath axis.
      java.lang.String getNamespacePrefix​(java.lang.Object ns)
      Retrieve the namespace prefix of a namespace node.
      java.lang.String getNamespaceStringValue​(java.lang.Object ns)
      Retrieve the string-value of a namespace node.
      short getNodeType​(java.lang.Object node)
      Returns a number that identifies the type of node that the given object represents in this navigator.
      java.util.Iterator getParentAxisIterator​(java.lang.Object contextNode)
      Retrieve an Iterator matching the parent XPath axis.
      java.lang.Object getParentNode​(java.lang.Object contextNode)
      Returns the parent of the given context node.
      java.util.Iterator getPrecedingAxisIterator​(java.lang.Object contextNode)
      Retrieve an Iterator matching the preceding XPath axis.
      java.util.Iterator getPrecedingSiblingAxisIterator​(java.lang.Object contextNode)
      Retrieve an Iterator matching the preceding-sibling XPath axis.
      java.lang.String getProcessingInstructionData​(java.lang.Object pi)
      Retrieve the data of a processing-instruction.
      java.lang.String getProcessingInstructionTarget​(java.lang.Object pi)
      Retrieve the target of a processing-instruction.
      java.util.Iterator getSelfAxisIterator​(java.lang.Object contextNode)
      Retrieve an Iterator matching the self XPath axis.
      java.lang.String getTextStringValue​(java.lang.Object text)
      Retrieve the string-value of a text node.
      boolean isAttribute​(java.lang.Object object)
      Returns whether the given object is an attribute node.
      boolean isComment​(java.lang.Object object)
      Returns whether the given object is a comment node.
      boolean isDocument​(java.lang.Object object)
      Returns whether the given object is a document node.
      boolean isElement​(java.lang.Object object)
      Returns whether the given object is an element node.
      boolean isNamespace​(java.lang.Object object)
      Returns whether the given object is a namespace node.
      boolean isProcessingInstruction​(java.lang.Object object)
      Returns whether the given object is a processing-instruction node.
      boolean isText​(java.lang.Object object)
      Returns whether the given object is a text node.
      XPath parseXPath​(java.lang.String xpath)
      Returns a parsed form of the given XPath string, which will be suitable for queries on documents that use the same navigator as this one.
      java.lang.String translateNamespacePrefixToUri​(java.lang.String prefix, java.lang.Object element)
      Translate a namespace prefix to a namespace URI, possibly considering a particular element node.
    • Method Detail

      • getChildAxisIterator

        java.util.Iterator getChildAxisIterator​(java.lang.Object contextNode)
                                         throws UnsupportedAxisException
        Retrieve an Iterator matching the child XPath axis.
        Parameters:
        contextNode - the original context node
        Returns:
        an Iterator capable of traversing the axis, not null
        Throws:
        UnsupportedAxisException - if the semantics of the child axis are not supported by this object model
      • getDescendantAxisIterator

        java.util.Iterator getDescendantAxisIterator​(java.lang.Object contextNode)
                                              throws UnsupportedAxisException
        Retrieve an Iterator matching the descendant XPath axis.
        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

        java.util.Iterator getParentAxisIterator​(java.lang.Object contextNode)
                                          throws UnsupportedAxisException
        Retrieve an Iterator matching the parent XPath axis.
        Parameters:
        contextNode - the original context node
        Returns:
        an Iterator capable of traversing the axis, not null
        Throws:
        UnsupportedAxisException - if the semantics of the parent axis are not supported by this object model
      • getAncestorAxisIterator

        java.util.Iterator getAncestorAxisIterator​(java.lang.Object contextNode)
                                            throws UnsupportedAxisException
        Retrieve an Iterator matching the ancestor XPath axis.
        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

        java.util.Iterator getFollowingSiblingAxisIterator​(java.lang.Object contextNode)
                                                    throws UnsupportedAxisException
        Retrieve an Iterator matching the following-sibling XPath axis.
        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

        java.util.Iterator getPrecedingSiblingAxisIterator​(java.lang.Object contextNode)
                                                    throws UnsupportedAxisException
        Retrieve an Iterator matching the preceding-sibling XPath axis.
        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

        java.util.Iterator getFollowingAxisIterator​(java.lang.Object contextNode)
                                             throws UnsupportedAxisException
        Retrieve an Iterator matching the following XPath axis.
        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

        java.util.Iterator getPrecedingAxisIterator​(java.lang.Object contextNode)
                                             throws UnsupportedAxisException
        Retrieve an Iterator matching the preceding XPath axis.
        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

        java.util.Iterator getAttributeAxisIterator​(java.lang.Object contextNode)
                                             throws UnsupportedAxisException
        Retrieve an Iterator matching the attribute XPath axis.
        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

        java.util.Iterator getNamespaceAxisIterator​(java.lang.Object contextNode)
                                             throws UnsupportedAxisException
        Retrieve an Iterator matching the namespace XPath axis.
        Parameters:
        contextNode - the original context node
        Returns:
        an Iterator capable of traversing the axis, not null
        Throws:
        UnsupportedAxisException - if the semantics of the namespace axis are not supported by this object model
      • getSelfAxisIterator

        java.util.Iterator getSelfAxisIterator​(java.lang.Object contextNode)
                                        throws UnsupportedAxisException
        Retrieve an Iterator matching the self XPath axis.
        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

        java.util.Iterator getDescendantOrSelfAxisIterator​(java.lang.Object contextNode)
                                                    throws UnsupportedAxisException
        Retrieve an Iterator matching the descendant-or-self XPath axis.
        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

        java.util.Iterator getAncestorOrSelfAxisIterator​(java.lang.Object contextNode)
                                                  throws UnsupportedAxisException
        Retrieve an Iterator matching the ancestor-or-self XPath axis.
        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
      • getDocument

        java.lang.Object getDocument​(java.lang.String uri)
                              throws FunctionCallException
        Loads a document from the given URI
        Parameters:
        uri - the URI of the document to load
        Returns:
        the document
        Throws:
        FunctionCallException - if the document could not be loaded
      • getDocumentNode

        java.lang.Object getDocumentNode​(java.lang.Object contextNode)
        Returns the document node that contains the given context node.
        Parameters:
        contextNode - the context node
        Returns:
        the document of the context node
        See Also:
        isDocument(Object)
      • getElementNamespaceUri

        java.lang.String getElementNamespaceUri​(java.lang.Object element)
        Retrieve the namespace URI of the given element node.
        Parameters:
        element - the context element node
        Returns:
        the namespace URI of the element node
      • getElementName

        java.lang.String getElementName​(java.lang.Object element)
        Retrieve the local name of the given element node.
        Parameters:
        element - the context element node
        Returns:
        the local name of the element node
      • getElementQName

        java.lang.String getElementQName​(java.lang.Object element)
        Retrieve the qualified name of the given element node.
        Parameters:
        element - the context element node
        Returns:
        the qualified name of the element node
      • getAttributeNamespaceUri

        java.lang.String getAttributeNamespaceUri​(java.lang.Object attr)
        Retrieve the namespace URI of the given attribute node.
        Parameters:
        attr - the context attribute node
        Returns:
        the namespace URI of the attribute node
      • getAttributeName

        java.lang.String getAttributeName​(java.lang.Object attr)
        Retrieve the local name of the given attribute node.
        Parameters:
        attr - the context attribute node
        Returns:
        the local name of the attribute node
      • getAttributeQName

        java.lang.String getAttributeQName​(java.lang.Object attr)
        Retrieve the qualified name of the given attribute node.
        Parameters:
        attr - the context attribute node
        Returns:
        the qualified name of the attribute node
      • getProcessingInstructionTarget

        java.lang.String getProcessingInstructionTarget​(java.lang.Object pi)
        Retrieve the target of a processing-instruction.
        Parameters:
        pi - the context processing-instruction node
        Returns:
        the target of the processing-instruction node
      • getProcessingInstructionData

        java.lang.String getProcessingInstructionData​(java.lang.Object pi)
        Retrieve the data of a processing-instruction.
        Parameters:
        pi - the context processing-instruction node
        Returns:
        the data of the processing-instruction node
      • isDocument

        boolean isDocument​(java.lang.Object object)
        Returns whether the given object is a document node. A document node is the node that is selected by the XPath expression /.
        Parameters:
        object - the object to test
        Returns:
        true if the object is a document node, else false
      • isElement

        boolean isElement​(java.lang.Object object)
        Returns whether the given object is an element node.
        Parameters:
        object - the object to test
        Returns:
        true if the object is an element node, else false
      • isAttribute

        boolean isAttribute​(java.lang.Object object)
        Returns whether the given object is an attribute node.
        Parameters:
        object - the object to test
        Returns:
        true if the object is an attribute node, else false
      • isNamespace

        boolean isNamespace​(java.lang.Object object)
        Returns whether the given object is a namespace node.
        Parameters:
        object - the object to test
        Returns:
        true if the object is a namespace node, else false
      • isComment

        boolean isComment​(java.lang.Object object)
        Returns whether the given object is a comment node.
        Parameters:
        object - the object to test
        Returns:
        true if the object is a comment node, else false
      • isText

        boolean isText​(java.lang.Object object)
        Returns whether the given object is a text node.
        Parameters:
        object - the object to test
        Returns:
        true if the object is a text node, else false
      • isProcessingInstruction

        boolean isProcessingInstruction​(java.lang.Object object)
        Returns whether the given object is a processing-instruction node.
        Parameters:
        object - the object to test
        Returns:
        true if the object is a processing-instruction node, else false
      • getCommentStringValue

        java.lang.String getCommentStringValue​(java.lang.Object comment)
        Retrieve the string-value of a comment node. This may be the empty string if the comment is empty, but must not be null.
        Parameters:
        comment - the comment node
        Returns:
        the string-value of the node
      • getElementStringValue

        java.lang.String getElementStringValue​(java.lang.Object element)
        Retrieve the string-value of an element node. This may be the empty string if the element is empty, but must not be null.
        Parameters:
        element - the comment node.
        Returns:
        the string-value of the node.
      • getAttributeStringValue

        java.lang.String getAttributeStringValue​(java.lang.Object attr)
        Retrieve the string-value of an attribute node. This should be the XML 1.0 normalized attribute value. This may be the empty string but must not be null.
        Parameters:
        attr - the attribute node
        Returns:
        the string-value of the node
      • getNamespaceStringValue

        java.lang.String getNamespaceStringValue​(java.lang.Object ns)
        Retrieve the string-value of a namespace node. This is generally the namespace URI. This may be the empty string but must not be null.
        Parameters:
        ns - the namespace node
        Returns:
        the string-value of the node
      • getTextStringValue

        java.lang.String getTextStringValue​(java.lang.Object text)
        Retrieve the string-value of a text node. This must not be null and should not be the empty string. The XPath data model does not allow empty text nodes.
        Parameters:
        text - the text node
        Returns:
        the string-value of the node
      • getNamespacePrefix

        java.lang.String getNamespacePrefix​(java.lang.Object ns)
        Retrieve the namespace prefix of a namespace node.
        Parameters:
        ns - the namespace node
        Returns:
        the prefix associated with the node
      • translateNamespacePrefixToUri

        java.lang.String translateNamespacePrefixToUri​(java.lang.String prefix,
                                                       java.lang.Object element)
        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.

        Parameters:
        prefix - the prefix to translate
        element - the element to consider during translation
        Returns:
        the namespace URI associated with the prefix
        See Also:
        NamespaceContext
      • parseXPath

        XPath parseXPath​(java.lang.String xpath)
                  throws SAXPathException
        Returns a parsed form of the given XPath string, which will be suitable for queries on documents that use the same navigator as this one.
        Parameters:
        xpath - the XPath expression
        Returns:
        a new XPath expression object
        Throws:
        SAXPathException - if the string is not a syntactically correct XPath expression
        See Also:
        XPath
      • getElementById

        java.lang.Object getElementById​(java.lang.Object contextNode,
                                        java.lang.String elementId)
        Returns the element whose ID is given by elementId. If no such element exists, returns null. Attributes with the name "ID" are not of type ID unless so defined. Implementations that do not know whether attributes are of type ID or not are expected to return null.
        Parameters:
        contextNode - a node from the document in which to look for the id
        elementId - id to look for
        Returns:
        element whose ID is given by elementId, or null if no such element exists in the document or if the implementation does not know about attribute types
      • getNodeType

        short getNodeType​(java.lang.Object node)
        Returns a number that identifies the type of node that the given object represents in this navigator.
        Parameters:
        node - ????
        Returns:
        ????
        See Also:
        Pattern