public class XPathEvaluator extends Object implements Evaluator, Serializable
An Evaluator implementation for XPath environments.
Does not support the <script> module, throws
 UnsupportedOperationException if attempted.
| Modifier and Type | Class and Description | 
|---|---|
static class  | 
XPathEvaluator.XPathEvaluatorProvider  | 
Evaluator.AssignType| Modifier and Type | Field and Description | 
|---|---|
static String | 
SUPPORTED_DATA_MODEL  | 
DEFAULT_DATA_MODEL, ECMASCRIPT_DATA_MODEL, NULL_DATA_MODEL, XPATH_DATA_MODEL| Constructor and Description | 
|---|
XPathEvaluator()
No argument constructor. 
 | 
XPathEvaluator(org.apache.commons.jxpath.Functions functions)
Constructor supporting user-defined JXPath  
Functions. | 
| Modifier and Type | Method and Description | 
|---|---|
protected void | 
assign(Context ctx,
            Node node,
            String nodePath,
            Object data,
            Evaluator.AssignType type,
            String attr)  | 
void | 
assign(Context ctx,
            Object location,
            Object data,
            Evaluator.AssignType type,
            String attr)
Assigns data to a location 
 | 
Object | 
eval(Context ctx,
        String expr)
Evaluate an expression returning a data value 
 | 
void | 
evalAssign(Context ctx,
                    String location,
                    Object data,
                    Evaluator.AssignType type,
                    String attr)
Assigns data to a location 
 | 
Boolean | 
evalCond(Context ctx,
                String expr)
Evaluate a condition. 
 | 
Object | 
evalLocation(Context ctx,
                        String expr)
Evaluate a location that returns a data assignable reference or list of references. 
 | 
Object | 
evalScript(Context ctx,
                    String script)
Evaluate a script. 
 | 
protected org.apache.commons.jxpath.JXPathContext | 
getContext(Context ctx)  | 
String | 
getSupportedDatamodel()
Get the datamodel type supported by this Evaluator 
 | 
boolean | 
isXPathLocation(Context ctx,
                              Object data)
Determine if an  
Evaluator.evalLocation(Context, String) returned result represents an XPath location | 
Context | 
newContext(Context parent)
Create a new child context. 
 | 
public static final String SUPPORTED_DATA_MODEL
public XPathEvaluator()
public XPathEvaluator(org.apache.commons.jxpath.Functions functions)
Functions.functions - The user-defined JXPath functions to use.public String getSupportedDatamodel()
EvaluatorgetSupportedDatamodel in interface Evaluatorpublic Object eval(Context ctx, String expr) throws SCXMLExpressionException
Evaluatoreval in interface Evaluatorctx - variable contextexpr - expressionSCXMLExpressionException - A malformed expression exceptionEvaluator.eval(Context, String)public Boolean evalCond(Context ctx, String expr) throws SCXMLExpressionException
EvaluatorevalCond in interface Evaluatorctx - variable contextexpr - expressionSCXMLExpressionException - A malformed expression exceptionEvaluator.evalCond(Context, String)public Object evalLocation(Context ctx, String expr) throws SCXMLExpressionException
EvaluatorevalLocation in interface Evaluatorctx - variable contextexpr - expressionSCXMLExpressionException - A malformed expression exceptionEvaluator.evalLocation(Context, String)public void evalAssign(Context ctx, String location, Object data, Evaluator.AssignType type, String attr) throws SCXMLExpressionException
EvaluatorevalAssign in interface Evaluatorctx - variable contextlocation - location expressiondata - the data to assign.type - the type of assignment to perform, null assumes Evaluator.AssignType.REPLACE_CHILDRENattr - the name of the attribute to add when using type Evaluator.AssignType.ADD_ATTRIBUTESCXMLExpressionException - A malformed expression exceptionEvaluator.evalAssign(Context, String, Object, AssignType, String)public Object evalScript(Context ctx, String script) throws SCXMLExpressionException
EvaluatorevalScript in interface Evaluatorctx - variable contextscript - The scriptSCXMLExpressionException - A malformed scriptEvaluator.evalScript(Context, String)public Context newContext(Context parent)
EvaluatornewContext in interface Evaluatorparent - parent contextEvaluator.newContext(Context)public boolean isXPathLocation(Context ctx, Object data)
Evaluator.evalLocation(Context, String) returned result represents an XPath locationctx - variable contextdata - result data from Evaluator.evalLocation(Context, String)public void assign(Context ctx, Object location, Object data, Evaluator.AssignType type, String attr) throws SCXMLExpressionException
ctx - variable contextlocation - location expressiondata - the data to assign.type - the type of assignment to perform, null assumes Evaluator.AssignType#REPLACE_CHILDRENattr - the name of the attribute to add when using type Evaluator.AssignType#ADD_ATTRIBUTESCXMLExpressionException - A malformed expression exceptionEvaluator.evalAssign(Context, String, Object, Evaluator.AssignType, String)protected void assign(Context ctx, Node node, String nodePath, Object data, Evaluator.AssignType type, String attr) throws SCXMLExpressionException
SCXMLExpressionExceptionprotected org.apache.commons.jxpath.JXPathContext getContext(Context ctx) throws SCXMLExpressionException
SCXMLExpressionExceptionCopyright © 2005–2015 The Apache Software Foundation. All rights reserved.