org.apache.jackrabbit.core.query.xpath
Class XPathQueryBuilder

java.lang.Object
  extended byorg.apache.jackrabbit.core.query.xpath.XPathQueryBuilder

public class XPathQueryBuilder
extends Object

Query builder that translates a XPath statement into a query tree structure.


Method Summary
static QueryRootNode createQuery(String statement, NamespaceResolver resolver)
          Creates a QueryNode tree from a XPath statement.
static String toString(QueryRootNode root, NamespaceResolver resolver)
          Creates a String representation of the query node tree in XPath syntax.
 Object visit(SimpleNode node, Object data)
          Implements the generic visit method for this XPathVisitor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createQuery

public static QueryRootNode createQuery(String statement,
                                        NamespaceResolver resolver)
                                 throws InvalidQueryException
Creates a QueryNode tree from a XPath statement.

Parameters:
statement - the XPath statement.
resolver - the namespace resolver to use.
Returns:
the QueryNode tree for the XPath statement.
Throws:
InvalidQueryException - if the XPath statement is malformed.

toString

public static String toString(QueryRootNode root,
                              NamespaceResolver 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 QNames.
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.

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.


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.