public class Context extends Object implements Serializable
NOTE: This class is not typically used directly, but is exposed for writers of implementation-specific XPath packages.
The Context
bundles utilities together
for evaluation of the expression. It wraps the provided
objects for ease-of-passage through the expression
AST.
ContextSupport
,
BaseXPath
,
XPath for dom4j
,
XPath for JDOM
,
XPath for W3C DOM
,
Serialized FormConstructor and Description |
---|
Context(ContextSupport contextSupport)
Create a new context.
|
Modifier and Type | Method and Description |
---|---|
Context |
duplicate()
Create a type-safe shallow copy.
|
ContextSupport |
getContextSupport()
Retrieve the
ContextSupport . |
Function |
getFunction(String namespaceURI,
String prefix,
String localName)
Retrieve a
Function . |
Navigator |
getNavigator()
Retrieve the current
Navigator . |
List |
getNodeSet()
Retrieve the context node-set.
|
int |
getPosition()
Retrieve current position in the context node-set.
|
int |
getSize()
Retrieve the size of the current context node-set.
|
Object |
getVariableValue(String namespaceURI,
String prefix,
String localName)
Retrieve a variable value.
|
void |
setContextSupport(ContextSupport contextSupport)
Set the
ContextSupport . |
void |
setNodeSet(List nodeSet)
Set the context node-set, and sets the current context size to the size
of this node-set.
|
void |
setPosition(int position)
Set the current position in the context node-set.
|
void |
setSize(int size)
Set the current size in the context node-set.
|
String |
translateNamespacePrefixToUri(String prefix)
Translate a namespace prefix to its URI.
|
public Context(ContextSupport contextSupport)
contextSupport
- the context-supportpublic void setNodeSet(List nodeSet)
Set the context node-set, and sets the current context size to the size of this node-set.
The actual list is stored in this object. A copy is not made. This list should not be modified in other code after calling this method.
After invoking this method, the client should immediately call
setSize
and setPosition
.
nodeSet
- the context node-setpublic List getNodeSet()
public void setContextSupport(ContextSupport contextSupport)
ContextSupport
.contextSupport
- the context-supportpublic ContextSupport getContextSupport()
ContextSupport
.public Navigator getNavigator()
Navigator
.public String translateNamespacePrefixToUri(String prefix)
prefix
- the prefixpublic Object getVariableValue(String namespaceURI, String prefix, String localName) throws UnresolvableException
namespaceURI
- the function namespace URIprefix
- the function prefixlocalName
- the function nameUnresolvableException
- if unable to locate a bound variablepublic Function getFunction(String namespaceURI, String prefix, String localName) throws UnresolvableException
Function
.namespaceURI
- the function namespace URIprefix
- the function prefixlocalName
- the function nameUnresolvableException
- if unable to locate a bound functionpublic void setSize(int size)
size
- the sizepublic int getSize()
public void setPosition(int position)
position
- the positionpublic int getPosition()
public Context duplicate()
Copyright 2001–2022 The Jaxen Project. All rights reserved.