Class XPathQueryBuilder

    • Method Detail

      • createQuery

        public static QueryRootNode createQuery​(String statement,
                                                NameResolver resolver,
                                                QueryNodeFactory factory)
                                         throws InvalidQueryException
        Creates a QueryNode tree from a XPath statement using the passed query node factory.
        Parameters:
        statement - the XPath statement.
        resolver - the name resolver to use.
        factory - the query node factory.
        Returns:
        the QueryNode tree for the XPath statement.
        Throws:
        InvalidQueryException - if the XPath statement is malformed.
      • toString

        public static String toString​(QueryRootNode root,
                                      NameResolver resolver)
                               throws InvalidQueryException
        Creates a String representation of the query node tree in XPath syntax.
        Parameters:
        root - the root of the query node tree.
        resolver - to resolve Names.
        Returns:
        a String representation of the query node tree.
        Throws:
        InvalidQueryException - if the query node tree cannot be converted into a String representation due to restrictions in XPath.
      • visit

        public Object visit​(SimpleNode node,
                            Object data)
        Implements the generic visit method for this XPathVisitor.
        Specified by:
        visit in interface XPathVisitor
        Parameters:
        node - the current node as created by the XPath parser.
        data - the current QueryNode created by this XPathVisitor.
        Returns:
        the current QueryNode. Can be different from data.