public class OutermostExprContext extends Object implements ExprContext
Though non-abstract for unit testing reasons, this basic implementation is intended to be subclassed.
Constructor and Description |
---|
OutermostExprContext() |
Modifier and Type | Method and Description |
---|---|
XNode |
findElementWithId(XNode node,
String id)
Returns
null because this basic implementation
is not schema-aware. |
XNode |
getCurrent(XNode contextNode)
Returns its context node argument because "current()".eval(node) should
return node.
|
NodeIterator |
getDocument(String uriRef,
URL baseURL)
Returns
NullNodeIterator.INSTANCE because this basic
implementation does not know how to load documents. |
NodeIterator |
getKeyedNodes(Name keyName,
String keyValue,
XNode node)
Returns
NullNodeIterator.INSTANCE because this basic
implementation does not support key(). |
int |
getLastPosition()
Returns 1 because in outermost_expression.eval(node) the current node list
just contains node.
|
int |
getPosition()
Returns 1 because in outermost_expression.eval(node) the current node list
just contains node.
|
Variant |
getVariableValue(Name name,
XNode node)
Returns
null because this basic implementation
does not handle variable references. |
boolean |
isElementWithId(XNode node,
String id)
Returns
false because this basic implementation
is not schema aware. |
public int getPosition() throws EvalException
getPosition
in interface ExprContext
EvalException
public int getLastPosition() throws EvalException
getLastPosition
in interface ExprContext
EvalException
public Variant getVariableValue(Name name, XNode node) throws EvalException
null
because this basic implementation
does not handle variable references.getVariableValue
in interface ExprContext
node
- the context node. Generally not useful.EvalException
public XNode getCurrent(XNode contextNode)
In practice, this method is never invoked because 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
null
because this basic implementation
is not schema-aware.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
false
because this basic implementation
is not schema aware.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
NullNodeIterator.INSTANCE
because this basic
implementation does not know how to load documents.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 operationNullNodeIterator
public NodeIterator getKeyedNodes(Name keyName, String keyValue, XNode node) throws EvalException
NullNodeIterator.INSTANCE
because this basic
implementation does not support key().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