Class SimplePathInterpreter
java.lang.Object
org.apache.commons.jxpath.ri.axes.SimplePathInterpreter
An evaluation mechanism for simple XPaths, which
is much faster than the usual process. It is only used for
xpaths which have no context-dependent parts, consist entirely of
child::name
and self::node()
steps with
predicates that either integer or have the form [@name = ...]
.- Version:
- $Revision: 652845 $ $Date: 2008-05-02 12:46:46 -0500 (Fri, 02 May 2008) $
- Author:
- Dmitri Plotnikov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NodePointer
createNullPointer
(EvalContext context, NodePointer parent, Step[] steps, int currentStep) Creates a "null pointer" that a) represents the requested path and b) can be used for creation of missing nodes in the path.static NodePointer
interpretSimpleExpressionPath
(EvalContext context, NodePointer root, Expression[] predicates, Step[] steps) Interpret the steps of a simple expression path that starts with the given root, which is the result of evaluation of the root expression of the expression path, applies the given predicates to it and then follows the given steps.static NodePointer
interpretSimpleLocationPath
(EvalContext context, NodePointer root, Step[] steps) Interpret a simple path that starts with the given root and follows the given steps.
-
Constructor Details
-
SimplePathInterpreter
public SimplePathInterpreter()
-
-
Method Details
-
interpretSimpleLocationPath
public static NodePointer interpretSimpleLocationPath(EvalContext context, NodePointer root, Step[] steps) Interpret a simple path that starts with the given root and follows the given steps. All steps must have the axis "child::" and a name test. They can also optionally have predicates of type [@name=expression] or simply [expression] interpreted as an index.- Parameters:
context
- evaluation contextroot
- root pointersteps
- path steps- Returns:
- NodePointer
-
interpretSimpleExpressionPath
public static NodePointer interpretSimpleExpressionPath(EvalContext context, NodePointer root, Expression[] predicates, Step[] steps) Interpret the steps of a simple expression path that starts with the given root, which is the result of evaluation of the root expression of the expression path, applies the given predicates to it and then follows the given steps. All steps must have the axis "child::" or "attribute::" and a name test. They can also optionally have predicates of type [@name=...] or simply [...] interpreted as an index.- Parameters:
context
- evaluation contextroot
- root pointerpredicates
- predicates corresponding tosteps
steps
- path steps- Returns:
- NodePointer
-
createNullPointer
public static NodePointer createNullPointer(EvalContext context, NodePointer parent, Step[] steps, int currentStep) Creates a "null pointer" that a) represents the requested path and b) can be used for creation of missing nodes in the path.- Parameters:
context
- evaluation contextparent
- parent pointersteps
- path stepscurrentStep
- step number- Returns:
- NodePointer
-