Package org.javarosa.xpath.expr
Class XPathPathExpr
java.lang.Object
org.javarosa.xpath.expr.XPathExpression
org.javarosa.xpath.expr.XPathPathExpr
- All Implemented Interfaces:
Serializable,Externalizable
public class XPathPathExpr extends XPathExpression
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description XPathFilterExprfiltExprintinit_contextstatic intINIT_CONTEXT_EXPRstatic intINIT_CONTEXT_RELATIVEstatic intINIT_CONTEXT_ROOTXPathStep[]steps -
Constructor Summary
Constructors Constructor Description XPathPathExpr()XPathPathExpr(int init_context, XPathStep[] steps)XPathPathExpr(XPathFilterExpr filtExpr, XPathStep[] steps) -
Method Summary
Modifier and Type Method Description booleanequals(Object o)XPathNodeseteval(DataInstance unusedDataInstance, EvaluationContext ec)static XPathPathExprfromRef(TreeReference ref)TreeReferencegetReference()translate an xpath path reference into a TreeReference TreeReferences only support a subset of true xpath paths; restrictions are: simple child name tests 'child::name', '.', and '..' allowed only no predicates all '..' steps must come before anything elsestatic ObjectgetRefValue(DataInstance model, EvaluationContext ec, TreeReference ref)booleanmatches(XPathExpression o)Warning: this method has somewhat unclear semantics.Objectpivot(DataInstance model, EvaluationContext evalContext, List<Object> pivots, Object sentinal)Pivot this expression, returning values if appropriate, and adding any pivots to the list.voidreadExternal(DataInputStream in, PrototypeFactory pf)StringtoString()static ObjectunpackValue(IAnswerData val)voidwriteExternal(DataOutputStream out)Methods inherited from class org.javarosa.xpath.expr.XPathExpression
eval, hashCode, pivot, print, printParseTree
-
Field Details
-
INIT_CONTEXT_ROOT
public static final int INIT_CONTEXT_ROOT- See Also:
- Constant Field Values
-
INIT_CONTEXT_RELATIVE
public static final int INIT_CONTEXT_RELATIVE- See Also:
- Constant Field Values
-
INIT_CONTEXT_EXPR
public static final int INIT_CONTEXT_EXPR- See Also:
- Constant Field Values
-
init_context
public int init_context -
steps
-
filtExpr
-
-
Constructor Details
-
XPathPathExpr
public XPathPathExpr() -
XPathPathExpr
-
XPathPathExpr
-
-
Method Details
-
getReference
translate an xpath path reference into a TreeReference TreeReferences only support a subset of true xpath paths; restrictions are: simple child name tests 'child::name', '.', and '..' allowed only no predicates all '..' steps must come before anything else- Throws:
XPathUnsupportedException
-
eval
- Specified by:
evalin classXPathExpression
-
getRefValue
-
unpackValue
-
toString
-
equals
-
matches
Warning: this method has somewhat unclear semantics. "matches" follows roughly the same process as equals(), in that it goes through the path step by step and compares whether each step can refer to the same node. The only difference is that match() will allow for a named step to match a step who's name is a wildcard. So \/data\/path\/to will "match" \/data\/*\/toeven though they are not equal.
Matching is reflexive, consistent, and symmetric, but _not_ transitive.
- Parameters:
o-- Returns:
- true if the expression is a path that matches this one
-
readExternal
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException- Throws:
IOExceptionDeserializationException
-
writeExternal
- Throws:
IOException
-
fromRef
-
pivot
public Object pivot(DataInstance model, EvaluationContext evalContext, List<Object> pivots, Object sentinal) throws UnpivotableExpressionExceptionDescription copied from class:XPathExpressionPivot this expression, returning values if appropriate, and adding any pivots to the list.- Overrides:
pivotin classXPathExpression- Parameters:
model- The model to evaluate the current expression againstevalContext- The evaluation context to evaluate againstpivots- The list of pivot points in the xpath being evaluated. Pivots should be added to this list.sentinal- The value which is being pivoted around.- Returns:
- null - If a pivot was identified in this expression sentinal - If the current expression represents the sentinal being pivoted any other value - The result of the expression if no pivots are detected
- Throws:
UnpivotableExpressionException- If the expression is too complex to pivot
-