public interface ExprContext
See OutermostExprContext
for a trivial implementation
which can be used to evaluate outermost expressions (that is,
an expression that is not part of another expression).
Modifier and Type | Method and Description |
---|---|
XNode |
findElementWithId(XNode node,
String id)
Used to implement the
id() function in an expression. |
XNode |
getCurrent(XNode contextNode)
Used to implement the
current() function. |
NodeIterator |
getDocument(String uriRef,
URL baseURL)
Used to implement the
document() function. |
NodeIterator |
getKeyedNodes(Name keyName,
String keyValue,
XNode node)
Used to implement the
key() function. |
int |
getLastPosition()
Returns a number equal to the context position
from this expression evaluation context.
|
int |
getPosition()
Returns a number equal to the context size
from this expression evaluation context.
|
Variant |
getVariableValue(Name name,
XNode node)
Returns the value of variable with specified name if any;
null otherwise |
boolean |
isElementWithId(XNode node,
String id)
Used to implement the
id() function in a pattern. |
int getPosition() throws EvalException
EvalException
int getLastPosition() throws EvalException
EvalException
Variant getVariableValue(Name name, XNode node) throws EvalException
null
otherwisenode
- the context node. Generally not useful.EvalException
XNode getCurrent(XNode contextNode)
current()
function.
In practice, the single only useful implementation of this method is in private class WithCurrentExpr.
contextNode
- the context node. For an outermost expression
(an expression not occurring within another expression),
the current node is always the same as the context node.XNode findElementWithId(XNode node, String id) throws EvalException
id()
function in an expression.node
- used to specify the documentid
- searched ID valuenull
otherwiseEvalException
- if a problem occurs during the searchboolean isElementWithId(XNode node, String id) throws EvalException
id()
function in a pattern.node
- node possibly having an ID attributeid
- ID value to be matched against the possible ID attribute of nodetrue
if specified node has an ID attribute
having specified value; false
otherwiseEvalException
- if a problem occurs during the matchNodeIterator getDocument(String uriRef, URL baseURL) throws EvalException
document()
function.uriRef
- specifies nodes (using a fragment) in a documentbaseURL
- URL possibly used to resolve relative URL in uriRef;
may be null
EvalException
- if a problem occurs during the operationNodeIterator getKeyedNodes(Name keyName, String keyValue, XNode node) throws EvalException
key()
function.keyName
- name of the keykeyValue
- searched valuenode
- the context node.The returned nodes don't need to be sorted by document order.
EvalException
- if a problem occurs during the operation