Interface VariableContext
-
- All Known Implementing Classes:
SimpleVariableContext
public interface VariableContext
Resolves variable bindings within an XPath expression.Variables within an XPath expression are denoted using notation such as
$varName
or$nsPrefix:varName
, and may refer to aBoolean
,Double
,String
, node-set (List
) or individual XML node.When a variable is bound to a node-set, the actual Java object returned should be a
java.util.List
containing XML nodes from the object-model (e.g. dom4j, JDOM, DOM, etc.) being used with the XPath.A variable may validly be assigned the
null
value, but an unbound variable (one that this context does not know about) should cause anUnresolvableException
to be thrown.Implementations of this interface should implement
Serializable
.- See Also:
SimpleVariableContext
,NamespaceContext
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Object
getVariableValue(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName)
An implementation should return the value of an XPath variable based on the namespace URI and local name of the variable-reference expression.
-
-
-
Method Detail
-
getVariableValue
java.lang.Object getVariableValue(java.lang.String namespaceURI, java.lang.String prefix, java.lang.String localName) throws UnresolvableException
An implementation should return the value of an XPath variable based on the namespace URI and local name of the variable-reference expression.It must not use the prefix parameter to select a variable, because a prefix could be bound to any namespace; the prefix parameter could be used in debugging output or other generated information. The prefix may otherwise be ignored.
- Parameters:
namespaceURI
- the namespace URI to which the prefix parameter is bound in the XPath expression. If the variable reference expression had no prefix, the namespace URI isnull
.prefix
- the prefix that was used in the variable reference expression; this value is ignored and has no effectlocalName
- the local name of the variable-reference expression. If there is no prefix, then this is the whole name of the variable.- Returns:
- the variable's value (which can be
null
) - Throws:
UnresolvableException
- when the variable cannot be resolved
-
-