org.jaxen

Class ContextSupport

public class ContextSupport extends Object implements Serializable

Supporting context information for resolving namespace prefixes, functions, and variables.

NOTE: This class is not typically used directly, but is exposed for writers of implementation-specific XPath packages.

Version: $Id: ContextSupport.java,v 1.13 2006/06/03 20:06:06 elharo Exp $

Author: bob mcwhirter

See Also: XPath for dom4j XPath for JDOM XPath for W3C DOM

Field Summary
FunctionContextfunctionContext
Function context.
NamespaceContextnamespaceContext
Namespace context.
Navigatornavigator
Model navigator.
static longserialVersionUID
VariableContextvariableContext
Variable context.
Constructor Summary
ContextSupport()
Construct an empty ContextSupport.
ContextSupport(NamespaceContext namespaceContext, FunctionContext functionContext, VariableContext variableContext, Navigator navigator)
Create a new ContextSupport object.
Method Summary
FunctiongetFunction(String namespaceURI, String prefix, String localName)
Retrieve a Function.
FunctionContextgetFunctionContext()
Retrieve the FunctionContext.
NamespaceContextgetNamespaceContext()
Retrieve the NamespaceContext.
NavigatorgetNavigator()
Retrieve the Navigator.
VariableContextgetVariableContext()
Retrieve the VariableContext.
ObjectgetVariableValue(String namespaceURI, String prefix, String localName)
Retrieve a variable value.
voidsetFunctionContext(FunctionContext functionContext)
Set the FunctionContext.
voidsetNamespaceContext(NamespaceContext namespaceContext)
Set the NamespaceContext.
voidsetVariableContext(VariableContext variableContext)
Set the VariableContext.
StringtranslateNamespacePrefixToUri(String prefix)
Translate a namespace prefix to its URI.

Field Detail

functionContext

private transient FunctionContext functionContext
Function context.

namespaceContext

private NamespaceContext namespaceContext
Namespace context.

navigator

private Navigator navigator
Model navigator.

serialVersionUID

private static final long serialVersionUID

variableContext

private VariableContext variableContext
Variable context.

Constructor Detail

ContextSupport

public ContextSupport()
Construct an empty ContextSupport.

ContextSupport

public ContextSupport(NamespaceContext namespaceContext, FunctionContext functionContext, VariableContext variableContext, Navigator navigator)
Create a new ContextSupport object.

Parameters: namespaceContext the NamespaceContext functionContext the FunctionContext variableContext the VariableContext navigator the model navigator

Method Detail

getFunction

public Function getFunction(String namespaceURI, String prefix, String localName)
Retrieve a Function.

Parameters: namespaceURI the function namespace URI prefix the function prefix localName the function name

Returns: the function object

Throws: UnresolvableException if unable to locate a bound function

getFunctionContext

public FunctionContext getFunctionContext()
Retrieve the FunctionContext.

Returns: the function context

getNamespaceContext

public NamespaceContext getNamespaceContext()
Retrieve the NamespaceContext.

Returns: the namespace context

getNavigator

public Navigator getNavigator()
Retrieve the Navigator.

Returns: the navigator

getVariableContext

public VariableContext getVariableContext()
Retrieve the VariableContext.

Returns: the variable context

getVariableValue

public Object getVariableValue(String namespaceURI, String prefix, String localName)
Retrieve a variable value.

Parameters: namespaceURI the function namespace URI prefix the function prefix localName the function name

Returns: the variable value.

Throws: UnresolvableException if unable to locate a bound variable.

setFunctionContext

public void setFunctionContext(FunctionContext functionContext)
Set the FunctionContext.

Parameters: functionContext the function context

setNamespaceContext

public void setNamespaceContext(NamespaceContext namespaceContext)
Set the NamespaceContext.

Parameters: namespaceContext the namespace context

setVariableContext

public void setVariableContext(VariableContext variableContext)
Set the VariableContext.

Parameters: variableContext the variable context

translateNamespacePrefixToUri

public String translateNamespacePrefixToUri(String prefix)
Translate a namespace prefix to its URI.

Parameters: prefix The prefix

Returns: the namespace URI mapped to the prefix