public abstract class DelegateExprContext extends Object implements ExprContext
ExprContext
.Modifier and Type | Field and Description |
---|---|
protected ExprContext |
origContext |
Modifier | Constructor and Description |
---|---|
protected |
DelegateExprContext(ExprContext context) |
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. |
protected ExprContext origContext
protected DelegateExprContext(ExprContext context)
public int getPosition() throws EvalException
ExprContext
getPosition
in interface ExprContext
EvalException
public int getLastPosition() throws EvalException
ExprContext
getLastPosition
in interface ExprContext
EvalException
public Variant getVariableValue(Name name, XNode node) throws EvalException
ExprContext
null
otherwisegetVariableValue
in interface ExprContext
node
- the context node. Generally not useful.EvalException
public XNode getCurrent(XNode contextNode)
ExprContext
current()
function.
In practice, the single only useful implementation of this method is in private class WithCurrentExpr.
getCurrent
in interface ExprContext
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.public XNode findElementWithId(XNode node, String id) throws EvalException
ExprContext
id()
function in an expression.findElementWithId
in interface ExprContext
node
- used to specify the documentid
- searched ID valuenull
otherwiseEvalException
- if a problem occurs during the searchpublic boolean isElementWithId(XNode node, String id) throws EvalException
ExprContext
id()
function in a pattern.isElementWithId
in interface ExprContext
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 matchpublic NodeIterator getDocument(String uriRef, URL baseURL) throws EvalException
ExprContext
document()
function.getDocument
in interface ExprContext
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 operationpublic NodeIterator getKeyedNodes(Name keyName, String keyValue, XNode node) throws EvalException
ExprContext
key()
function.getKeyedNodes
in interface ExprContext
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