Package org.jaxen.xom

Class DocumentNavigator

java.lang.Object
org.jaxen.DefaultNavigator
org.jaxen.xom.DocumentNavigator
All Implemented Interfaces:
Serializable, Navigator

public class DocumentNavigator extends DefaultNavigator
Interface for navigating around the XOM object model.

This class is not intended for direct usage, but is used by the Jaxen engine during evaluation.

See Also:
  • Constructor Details

    • DocumentNavigator

      public DocumentNavigator()
  • Method Details

    • isAttribute

      public boolean isAttribute(Object o)
      Description copied from interface: Navigator
      Returns whether the given object is an attribute node.
      Parameters:
      o - the object to test
      Returns:
      true if the object is an attribute node, else false
    • isComment

      public boolean isComment(Object o)
      Description copied from interface: Navigator
      Returns whether the given object is a comment node.
      Parameters:
      o - the object to test
      Returns:
      true if the object is a comment node, else false
    • isDocument

      public boolean isDocument(Object o)
      Description copied from interface: Navigator
      Returns whether the given object is a document node. A document node is the node that is selected by the XPath expression /.
      Parameters:
      o - the object to test
      Returns:
      true if the object is a document node, else false
    • isElement

      public boolean isElement(Object o)
      Description copied from interface: Navigator
      Returns whether the given object is an element node.
      Parameters:
      o - the object to test
      Returns:
      true if the object is an element node, else false
    • isNamespace

      public boolean isNamespace(Object o)
      Description copied from interface: Navigator
      Returns whether the given object is a namespace node.
      Parameters:
      o - the object to test
      Returns:
      true if the object is a namespace node, else false
    • isProcessingInstruction

      public boolean isProcessingInstruction(Object o)
      Description copied from interface: Navigator
      Returns whether the given object is a processing-instruction node.
      Parameters:
      o - the object to test
      Returns:
      true if the object is a processing-instruction node, else false
    • isText

      public boolean isText(Object o)
      Description copied from interface: Navigator
      Returns whether the given object is a text node.
      Parameters:
      o - the object to test
      Returns:
      true if the object is a text node, else false
    • getAttributeName

      public String getAttributeName(Object o)
      Description copied from interface: Navigator
      Retrieve the local name of the given attribute node.
      Parameters:
      o - the context attribute node
      Returns:
      the local name of the attribute node
    • getAttributeNamespaceUri

      public String getAttributeNamespaceUri(Object o)
      Description copied from interface: Navigator
      Retrieve the namespace URI of the given attribute node.
      Parameters:
      o - the context attribute node
      Returns:
      the namespace URI of the attribute node
    • getAttributeQName

      public String getAttributeQName(Object o)
      Description copied from interface: Navigator
      Retrieve the qualified name of the given attribute node.
      Parameters:
      o - the context attribute node
      Returns:
      the qualified name of the attribute node
    • getAttributeStringValue

      public String getAttributeStringValue(Object o)
      Description copied from interface: Navigator
      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:
      o - the attribute node
      Returns:
      the string-value of the node
    • getCommentStringValue

      public String getCommentStringValue(Object o)
      Description copied from interface: Navigator
      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:
      o - the comment node
      Returns:
      the string-value of the node
    • getElementName

      public String getElementName(Object o)
      Description copied from interface: Navigator
      Retrieve the local name of the given element node.
      Parameters:
      o - the context element node
      Returns:
      the local name of the element node
    • getElementNamespaceUri

      public String getElementNamespaceUri(Object o)
      Description copied from interface: Navigator
      Retrieve the namespace URI of the given element node.
      Parameters:
      o - the context element node
      Returns:
      the namespace URI of the element node
    • getElementQName

      public String getElementQName(Object o)
      Description copied from interface: Navigator
      Retrieve the qualified name of the given element node.
      Parameters:
      o - the context element node
      Returns:
      the qualified name of the element node
    • getElementStringValue

      public String getElementStringValue(Object o)
      Description copied from interface: Navigator
      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:
      o - the comment node.
      Returns:
      the string-value of the node.
    • getNamespacePrefix

      public String getNamespacePrefix(Object o)
      Description copied from interface: Navigator
      Retrieve the namespace prefix of a namespace node.
      Parameters:
      o - the namespace node
      Returns:
      the prefix associated with the node
    • getNamespaceStringValue

      public String getNamespaceStringValue(Object o)
      Description copied from interface: Navigator
      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:
      o - the namespace node
      Returns:
      the string-value of the node
    • getTextStringValue

      public String getTextStringValue(Object o)
      Description copied from interface: Navigator
      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:
      o - the text node
      Returns:
      the string-value of the node
    • getDocument

      public Object getDocument(String s) throws FunctionCallException
      Description copied from class: DefaultNavigator
      Default implementation that always returns null. Override in subclass if the subclass can load documents.
      Specified by:
      getDocument in interface Navigator
      Overrides:
      getDocument in class DefaultNavigator
      Parameters:
      s - 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
    • getDocumentNode

      public Object getDocumentNode(Object o)
      Description copied from interface: Navigator
      Returns the document node that contains the given context node.
      Specified by:
      getDocumentNode in interface Navigator
      Overrides:
      getDocumentNode in class DefaultNavigator
      Parameters:
      o - the context node
      Returns:
      the document of the context node
      See Also:
    • getAttributeAxisIterator

      public Iterator getAttributeAxisIterator(Object o)
      Description copied from class: DefaultNavigator
      Throws UnsupportedAxisException. Subclasses that support the attribute axis must override this method.
      Specified by:
      getAttributeAxisIterator in interface Navigator
      Overrides:
      getAttributeAxisIterator in class DefaultNavigator
      Parameters:
      o - the original context node
      Returns:
      never returns
    • getChildAxisIterator

      public Iterator getChildAxisIterator(Object o)
      Description copied from class: DefaultNavigator
      Throws UnsupportedAxisException
      Specified by:
      getChildAxisIterator in interface Navigator
      Overrides:
      getChildAxisIterator in class DefaultNavigator
      Parameters:
      o - the original context node
      Returns:
      never returns
    • getParentAxisIterator

      public Iterator getParentAxisIterator(Object o)
      Description copied from class: DefaultNavigator
      Throws UnsupportedAxisException
      Specified by:
      getParentAxisIterator in interface Navigator
      Overrides:
      getParentAxisIterator in class DefaultNavigator
      Parameters:
      o - the original context node
      Returns:
      never returns
    • getParentNode

      public Object getParentNode(Object o)
      Description copied from class: DefaultNavigator
      Default inefficient implementation. Subclasses should override this method.
      Specified by:
      getParentNode in interface Navigator
      Overrides:
      getParentNode in class DefaultNavigator
      Parameters:
      o - the node whose parent to return
      Returns:
      the parent node
      See Also:
    • getPrecedingAxisIterator

      public Iterator getPrecedingAxisIterator(Object o) throws UnsupportedAxisException
      Description copied from interface: Navigator
      Retrieve an Iterator matching the preceding XPath axis.
      Specified by:
      getPrecedingAxisIterator in interface Navigator
      Overrides:
      getPrecedingAxisIterator in class DefaultNavigator
      Parameters:
      o - 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
    • getPrecedingSiblingAxisIterator

      public Iterator getPrecedingSiblingAxisIterator(Object o) throws UnsupportedAxisException
      Description copied from interface: Navigator
      Retrieve an Iterator matching the preceding-sibling XPath axis.
      Specified by:
      getPrecedingSiblingAxisIterator in interface Navigator
      Overrides:
      getPrecedingSiblingAxisIterator in class DefaultNavigator
      Parameters:
      o - 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
    • getProcessingInstructionData

      public String getProcessingInstructionData(Object o)
      Description copied from interface: Navigator
      Retrieve the data of a processing-instruction.
      Specified by:
      getProcessingInstructionData in interface Navigator
      Overrides:
      getProcessingInstructionData in class DefaultNavigator
      Parameters:
      o - the context processing-instruction node
      Returns:
      the data of the processing-instruction node
    • getProcessingInstructionTarget

      public String getProcessingInstructionTarget(Object o)
      Description copied from interface: Navigator
      Retrieve the target of a processing-instruction.
      Specified by:
      getProcessingInstructionTarget in interface Navigator
      Overrides:
      getProcessingInstructionTarget in class DefaultNavigator
      Parameters:
      o - the context processing-instruction node
      Returns:
      the target of the processing-instruction node
    • translateNamespacePrefixToUri

      public String translateNamespacePrefixToUri(String s, Object o)
      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
      Overrides:
      translateNamespacePrefixToUri in class DefaultNavigator
      Parameters:
      s - the prefix to translate
      o - the element to consider during translation
      Returns:
      the namespace URI associated with the prefix
      See Also:
    • parseXPath

      public XPath parseXPath(String s) throws SAXPathException
      Description copied from interface: Navigator
      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:
      s - the XPath expression
      Returns:
      a new XPath expression object
      Throws:
      SAXPathException - if the string is not a syntactically correct XPath expression
      See Also:
    • getNamespaceAxisIterator

      public Iterator getNamespaceAxisIterator(Object o)
      Description copied from class: DefaultNavigator
      Throws UnsupportedAxisException. Subclasses that support the namespace axis must override this method.
      Specified by:
      getNamespaceAxisIterator in interface Navigator
      Overrides:
      getNamespaceAxisIterator in class DefaultNavigator
      Parameters:
      o - the original context node
      Returns:
      never returns