Class DocumentNavigator

    • Constructor Detail

      • DocumentNavigator

        public DocumentNavigator()
    • Method Detail

      • getInstance

        public static Navigator getInstance()
        Retrieve the singleton instance of this DocumentNavigator.
      • isElement

        public boolean isElement​(java.lang.Object obj)
        Description copied from interface: Navigator
        Returns whether the given object is an element node.
        Specified by:
        isElement in interface Navigator
        Parameters:
        obj - the object to test
        Returns:
        true if the object is an element node, else false
      • isComment

        public boolean isComment​(java.lang.Object obj)
        Description copied from interface: Navigator
        Returns whether the given object is a comment node.
        Specified by:
        isComment in interface Navigator
        Parameters:
        obj - the object to test
        Returns:
        true if the object is a comment node, else false
      • isText

        public boolean isText​(java.lang.Object obj)
        Description copied from interface: Navigator
        Returns whether the given object is a text node.
        Specified by:
        isText in interface Navigator
        Parameters:
        obj - the object to test
        Returns:
        true if the object is a text node, else false
      • isAttribute

        public boolean isAttribute​(java.lang.Object obj)
        Description copied from interface: Navigator
        Returns whether the given object is an attribute node.
        Specified by:
        isAttribute in interface Navigator
        Parameters:
        obj - the object to test
        Returns:
        true if the object is an attribute node, else false
      • isProcessingInstruction

        public boolean isProcessingInstruction​(java.lang.Object obj)
        Description copied from interface: Navigator
        Returns whether the given object is a processing-instruction node.
        Specified by:
        isProcessingInstruction in interface Navigator
        Parameters:
        obj - the object to test
        Returns:
        true if the object is a processing-instruction node, else false
      • isDocument

        public boolean isDocument​(java.lang.Object obj)
        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 /.
        Specified by:
        isDocument in interface Navigator
        Parameters:
        obj - the object to test
        Returns:
        true if the object is a document node, else false
      • isNamespace

        public boolean isNamespace​(java.lang.Object obj)
        Description copied from interface: Navigator
        Returns whether the given object is a namespace node.
        Specified by:
        isNamespace in interface Navigator
        Parameters:
        obj - the object to test
        Returns:
        true if the object is a namespace node, else false
      • getElementName

        public java.lang.String getElementName​(java.lang.Object obj)
        Description copied from interface: Navigator
        Retrieve the local name of the given element node.
        Specified by:
        getElementName in interface Navigator
        Parameters:
        obj - the context element node
        Returns:
        the local name of the element node
      • getElementNamespaceUri

        public java.lang.String getElementNamespaceUri​(java.lang.Object obj)
        Description copied from interface: Navigator
        Retrieve the namespace URI of the given element node.
        Specified by:
        getElementNamespaceUri in interface Navigator
        Parameters:
        obj - the context element node
        Returns:
        the namespace URI of the element node
      • getElementQName

        public java.lang.String getElementQName​(java.lang.Object obj)
        Description copied from interface: Navigator
        Retrieve the qualified name of the given element node.
        Specified by:
        getElementQName in interface Navigator
        Parameters:
        obj - the context element node
        Returns:
        the qualified name of the element node
      • getAttributeName

        public java.lang.String getAttributeName​(java.lang.Object obj)
        Description copied from interface: Navigator
        Retrieve the local name of the given attribute node.
        Specified by:
        getAttributeName in interface Navigator
        Parameters:
        obj - the context attribute node
        Returns:
        the local name of the attribute node
      • getAttributeNamespaceUri

        public java.lang.String getAttributeNamespaceUri​(java.lang.Object obj)
        Description copied from interface: Navigator
        Retrieve the namespace URI of the given attribute node.
        Specified by:
        getAttributeNamespaceUri in interface Navigator
        Parameters:
        obj - the context attribute node
        Returns:
        the namespace URI of the attribute node
      • getAttributeQName

        public java.lang.String getAttributeQName​(java.lang.Object obj)
        Description copied from interface: Navigator
        Retrieve the qualified name of the given attribute node.
        Specified by:
        getAttributeQName in interface Navigator
        Parameters:
        obj - the context attribute node
        Returns:
        the qualified name of the attribute node
      • getChildAxisIterator

        public java.util.Iterator getChildAxisIterator​(java.lang.Object contextNode,
                                                       java.lang.String localName,
                                                       java.lang.String namespacePrefix,
                                                       java.lang.String namespaceURI)
        Retrieves an Iterator over the child elements that match the supplied name.
        Specified by:
        getChildAxisIterator in interface NamedAccessNavigator
        Parameters:
        contextNode - the origin context node
        localName - the local name of the children to return, always present
        namespacePrefix - the prefix of the namespace of the children to return
        namespaceURI - the namespace URI of the children to return
        Returns:
        an Iterator that traverses the named children, or null if none
      • getAttributeAxisIterator

        public java.util.Iterator getAttributeAxisIterator​(java.lang.Object contextNode)
        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:
        contextNode - the original context node
        Returns:
        never returns
      • getAttributeAxisIterator

        public java.util.Iterator getAttributeAxisIterator​(java.lang.Object contextNode,
                                                           java.lang.String localName,
                                                           java.lang.String namespacePrefix,
                                                           java.lang.String namespaceURI)
        Retrieves an Iterator over the attribute elements that match the supplied name.
        Specified by:
        getAttributeAxisIterator in interface NamedAccessNavigator
        Parameters:
        contextNode - the origin context node
        localName - the local name of the attributes to return, always present
        namespacePrefix - the prefix of the namespace of the attributes to return
        namespaceURI - the namespace URI of the attributes to return
        Returns:
        an Iterator that traverses the named attributes, not null
      • getNamespaceAxisIterator

        public java.util.Iterator getNamespaceAxisIterator​(java.lang.Object contextNode)
        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:
        contextNode - the original context node
        Returns:
        never returns
      • getTextStringValue

        public java.lang.String getTextStringValue​(java.lang.Object obj)
        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.
        Specified by:
        getTextStringValue in interface Navigator
        Parameters:
        obj - the text node
        Returns:
        the string-value of the node
      • getElementStringValue

        public java.lang.String getElementStringValue​(java.lang.Object obj)
        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.
        Specified by:
        getElementStringValue in interface Navigator
        Parameters:
        obj - the comment node.
        Returns:
        the string-value of the node.
      • getAttributeStringValue

        public java.lang.String getAttributeStringValue​(java.lang.Object obj)
        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.
        Specified by:
        getAttributeStringValue in interface Navigator
        Parameters:
        obj - the attribute node
        Returns:
        the string-value of the node
      • getNamespaceStringValue

        public java.lang.String getNamespaceStringValue​(java.lang.Object obj)
        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.
        Specified by:
        getNamespaceStringValue in interface Navigator
        Parameters:
        obj - the namespace node
        Returns:
        the string-value of the node
      • getNamespacePrefix

        public java.lang.String getNamespacePrefix​(java.lang.Object obj)
        Description copied from interface: Navigator
        Retrieve the namespace prefix of a namespace node.
        Specified by:
        getNamespacePrefix in interface Navigator
        Parameters:
        obj - the namespace node
        Returns:
        the prefix associated with the node
      • getCommentStringValue

        public java.lang.String getCommentStringValue​(java.lang.Object obj)
        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.
        Specified by:
        getCommentStringValue in interface Navigator
        Parameters:
        obj - the comment node
        Returns:
        the string-value of the node
      • translateNamespacePrefixToUri

        public java.lang.String translateNamespacePrefixToUri​(java.lang.String prefix,
                                                              java.lang.Object context)
        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:
        prefix - the prefix to translate
        context - the element to consider during translation
        Returns:
        the namespace URI associated with the prefix
        See Also:
        NamespaceContext
      • getNodeType

        public short getNodeType​(java.lang.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
        Overrides:
        getNodeType in class DefaultNavigator
        Parameters:
        node - ????
        Returns:
        ????
        See Also:
        Pattern
      • getDocument

        public java.lang.Object getDocument​(java.lang.String uri)
                                     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:
        uri - 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
      • getProcessingInstructionData

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

        public XPath parseXPath​(java.lang.String xpath)
                         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.
        Specified by:
        parseXPath in interface Navigator
        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
      • javacase

        protected java.lang.String javacase​(java.lang.String name)