javax.xml.xpath

Interface XPath

    • Method Detail

      • reset

        void reset()

        Reset this XPath to its original configuration.

        XPath is reset to the same state as when it was created with XPathFactory.newXPath(). reset() is designed to allow the reuse of existing XPaths thus saving resources associated with the creation of new XPaths.

        The reset XPath is not guaranteed to have the same XPathFunctionResolver, XPathVariableResolver or NamespaceContext Objects, e.g. Object.equals(Object obj). It is guaranteed to have a functionally equal XPathFunctionResolver, XPathVariableResolver and NamespaceContext.

      • setXPathVariableResolver

        void setXPathVariableResolver(XPathVariableResolver resolver)

        Establish a variable resolver.

        A NullPointerException is thrown if resolver is null.

        Parameters:
        resolver - Variable resolver.
        Throws:
        NullPointerException - If resolver is null.
      • getXPathVariableResolver

        XPathVariableResolver getXPathVariableResolver()

        Return the current variable resolver.

        null is returned in no variable resolver is in effect.

        Returns:
        Current variable resolver.
      • setXPathFunctionResolver

        void setXPathFunctionResolver(XPathFunctionResolver resolver)

        Establish a function resolver.

        A NullPointerException is thrown if resolver is null.

        Parameters:
        resolver - XPath function resolver.
        Throws:
        NullPointerException - If resolver is null.
      • getXPathFunctionResolver

        XPathFunctionResolver getXPathFunctionResolver()

        Return the current function resolver.

        null is returned in no function resolver is in effect.

        Returns:
        Current function resolver.
      • setNamespaceContext

        void setNamespaceContext(NamespaceContext nsContext)

        Establish a namespace context.

        A NullPointerException is thrown if nsContext is null.

        Parameters:
        nsContext - Namespace context to use.
        Throws:
        NullPointerException - If nsContext is null.
      • getNamespaceContext

        NamespaceContext getNamespaceContext()

        Return the current namespace context.

        null is returned in no namespace context is in effect.

        Returns:
        Current Namespace context.
      • evaluate

        Object evaluate(String expression,
                      Object item,
                      QName returnType)
                        throws XPathExpressionException

        Evaluate an XPath expression in the specified context and return the result as the specified type.

        See Evaluation of XPath Expressions for context item evaluation, variable, function and QName resolution and return type conversion.

        If returnType is not one of the types defined in XPathConstants ( NUMBER, STRING, BOOLEAN, NODE or NODESET) then an IllegalArgumentException is thrown.

        If a null value is provided for item, an empty document will be used for the context. If expression or returnType is null, then a NullPointerException is thrown.

        Parameters:
        expression - The XPath expression.
        item - The starting context (a node, for example).
        returnType - The desired return type.
        Returns:
        Result of evaluating an XPath expression as an Object of returnType.
        Throws:
        XPathExpressionException - If expression cannot be evaluated.
        IllegalArgumentException - If returnType is not one of the types defined in XPathConstants.
        NullPointerException - If expression or returnType is null.

Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/xml/xpath/XPath.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : https://docs.oracle.com

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut