|
API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface XDynamicContext
Use the XDynamicContext
to override execution-time settings.
These are settings used when executing a prepared expression, query or
stylesheet. See the XPathExecutable
,
XQueryExecutable
, and XSLTExecutable
execute
methods that take an
XDynamicContext
as an argument.
The XFactory
class has the method newDynamicContext
for creating new instances.
Execution time settings such as the values of external variables
and resolvers for source, collections and results may be different
for each call to the execute
methods on an
Executable.
Examples of execution-time settings:
Collator
or a Locale
to a collation URI.
XExecutable
,
XPathExecutable
,
XQueryExecutable
,
XSLTExecutable
,
XFactory.newDynamicContext()
Method Summary | |
---|---|
void |
bind(QName name,
BigDecimal value)
Bind an atomic value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
BigInteger value)
Bind an atomic value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
boolean value)
Bind an atomic value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
byte value)
Bind an atomic value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
byte[] value)
Bind an atomic value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
double value)
Bind an atomic value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
Duration value)
Bind an atomic value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
float value)
Bind an atomic value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
int value)
Bind an atomic value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
long value)
Bind an atomic value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
Node value)
Bind a value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
Object value)
Bind an atomic value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
QName value)
Bind an atomic value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
short value)
Bind an atomic value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
Source source)
Bind a Source object as a value for a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
String value)
Bind an atomic value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
XItemView item)
Bind a single item value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bind(QName name,
XMLGregorianCalendar value)
Bind an atomic value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bindCollation(String uri,
Collator collator)
Associates the specified collation URI with the specified java.text.Collator . |
void |
bindCollation(String uri,
Locale locale)
Associates the specified collation URI with the java.text.Collator for the specified
java.util.Locale . |
void |
bindFunction(QName qname,
Method method)
Bind a function to a name. |
void |
bindFunction(QName qname,
Method method,
Object instanceObject)
Bind a function to a name. |
void |
bindSequence(QName name,
BigDecimal[] values)
Bind a sequence value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bindSequence(QName name,
BigInteger[] values)
Bind a sequence value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bindSequence(QName name,
boolean[] values)
Bind a sequence value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bindSequence(QName name,
byte[] values)
Bind a sequence value to a variable (XPath, XQuery) or a param (XSLT) depending on the type. |
void |
bindSequence(QName name,
byte[][] values)
Bind a sequence value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bindSequence(QName name,
double[] values)
Bind a sequence value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bindSequence(QName name,
Duration[] values)
Bind a sequence value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bindSequence(QName name,
float[] values)
Bind a sequence value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bindSequence(QName name,
int[] values)
Bind a sequence value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bindSequence(QName name,
long[] values)
Bind a sequence value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bindSequence(QName name,
QName[] values)
Bind a sequence value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bindSequence(QName name,
short[] values)
Bind a sequence value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bindSequence(QName name,
String[] values)
Bind a sequence value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bindSequence(QName name,
XMLGregorianCalendar[] values)
Bind a sequence value to a variable (XPath, XQuery) or a param (XSLT). |
void |
bindSequence(QName name,
XSequenceCursor sequence)
Bind a sequence value to a variable (XPath, XQuery) or a param (XSLT). |
String |
getBaseOutputURI()
Get the base output URI. |
Collator |
getCollation(String uri)
Get the Collator associated with the given
collation URI. |
XCollectionResolver |
getCollectionResolver()
Get the registered resolver for collections. |
boolean |
getFeature(String name)
Get the state of the named feature. |
Duration |
getImplicitTimeZone()
Get the implicit time zone as a Duration object. |
XMessageHandler |
getMessageHandler()
Get the dynamic message handler. |
XResultResolver |
getResultResolver()
Get the registered resolver for result documents. |
XSourceResolver |
getSourceResolver()
Get the registered resolver for source documents. |
XUnparsedTextResolver |
getUnparsedTextResolver()
Get the registered resolver for unparsed text resources. |
QName |
getXSLTInitialMode()
Get the name of the initial mode |
QName |
getXSLTInitialTemplate()
Get the name of the initial template. |
void |
removeBinding(QName qname)
Remove the binding for the specified variable. |
void |
removeCollationBinding(String uri)
Remove the Collator associated with the given
collation URI. |
void |
removeFunctionBinding(QName qname,
int arity)
Remove the binding for the specified function. |
void |
setBaseOutputURI(String uri)
Sets the base URI to use when resolving result documents. |
void |
setCollectionResolver(XCollectionResolver collectionResolver)
Registers a URI resolver for collections. |
void |
setFeature(String name,
boolean value)
Set a feature for this dynamic context . |
void |
setImplicitTimeZone(Duration implicitTimeZone)
Sets the implicit time zone. |
void |
setMessageHandler(XMessageHandler handler)
Set a message handler to process dynamic errors and messages. |
void |
setResultResolver(XResultResolver resultResolver)
Register a resolver for result documents. |
void |
setSourceResolver(XSourceResolver sourceResolver)
Register a resolver for dynamically resolved source documents such as for the fn:doc function and the XSLT
document function. |
void |
setUnparsedTextResolver(XUnparsedTextResolver unparsedTextResolver)
Register a resolver for external resources loaded through the XSLT unparsed-text function. |
void |
setXSLTInitialMode(QName initialMode)
Specify a mode to use as the initial mode in an XSLT transformation. |
void |
setXSLTInitialTemplate(QName initialTemplate)
Specify a named template to use as the initial template in an XSLT transformation. |
Method Detail |
---|
void bind(QName name, Object value)
name
- The name of the variable.value
- The value of the variable.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, String value)
name
- The name of the variable.value
- The value of the variable.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bindSequence(QName name, String[] values)
name
- The name of the variable.values
- The values for the sequence.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, boolean value)
name
- The name of the variable.value
- The value of the variable.
NullPointerException
- if name
is null
.XStaticContext.declareVariable(QName, QName)
void bindSequence(QName name, boolean[] values)
name
- The name of the variable.values
- The values for the sequence.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, byte value)
name
- The name of the variable.value
- The value of the variable.
NullPointerException
- if name
is null
.XStaticContext.declareVariable(QName, QName)
void bindSequence(QName name, byte[] values)
name
- The name of the variable.values
- The values for the sequence.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, byte[] value)
name
- The name of the variable.value
- The value of the variable.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bindSequence(QName name, byte[][] values)
name
- The name of the variable.values
- The values for the sequence.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, short value)
name
- The name of the variable.value
- The value of the variable.
NullPointerException
- if name
is null
.XStaticContext.declareVariable(QName, QName)
void bindSequence(QName name, short[] values)
name
- The name of the variable.values
- The values for the sequence.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, int value)
name
- The name of the variable.value
- The value of the variable.
NullPointerException
- if name
is null
.XStaticContext.declareVariable(QName, QName)
void bindSequence(QName name, int[] values)
name
- The name of the variable.values
- The values for the sequence.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, long value)
name
- The name of the variable.value
- The value of the variable.
NullPointerException
- if name
is null
.XStaticContext.declareVariable(QName, QName)
void bindSequence(QName name, long[] values)
name
- The name of the variable.values
- The values for the sequence.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, float value)
name
- The name of the variable.value
- The value of the variable.
NullPointerException
- if name
is null
.XStaticContext.declareVariable(QName, QName)
void bindSequence(QName name, float[] values)
name
- The name of the variable.values
- The values for the sequence.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, double value)
name
- The name of the variable.value
- The value of the variable.
NullPointerException
- if name
is null
.XStaticContext.declareVariable(QName, QName)
void bindSequence(QName name, double[] values)
name
- The name of the variable.values
- The values for the sequence.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, BigDecimal value)
name
- The name of the variable.value
- The value of the variable.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bindSequence(QName name, BigDecimal[] values)
name
- The name of the variable.values
- The values for the sequence.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, BigInteger value)
name
- The name of the variable.value
- The value of the variable.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bindSequence(QName name, BigInteger[] values)
name
- The name of the variable.values
- The values for the sequence.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, QName value)
name
- The name of the variable.value
- The value of the variable.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bindSequence(QName name, QName[] values)
name
- The name of the variable.values
- The values for the sequence.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, XMLGregorianCalendar value)
name
- The name of the variable.value
- The value of the variable.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bindSequence(QName name, XMLGregorianCalendar[] values)
name
- The name of the variable.values
- The values for the sequence.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, Duration value)
name
- The name of the variable.value
- The value of the variable.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bindSequence(QName name, Duration[] values)
name
- The name of the variable.values
- The values for the sequence.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, Node value)
name
- The name of the variable.value
- The value of the variable.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, Source source)
Source
object as a value for a variable (XPath, XQuery) or a param (XSLT).
The value must be valid for the type that was specified in the static
context (XPath), in the query (XQuery) or in the stylesheet (XSLT)
for the same name.
The source will be parsed and bound as an XItemView (just as if
XItemFactory.item(Source)
was called and the result
passed to bind(QName, XItemView)
).
name
- The name of the variable.source
- The Source
object.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bind(QName name, XItemView item)
name
- The name of the variable.item
- The item to bind to the variable.
NullPointerException
- if name
, or value
is null
.XStaticContext.declareVariable(QName, QName)
void bindSequence(QName name, XSequenceCursor sequence)
name
- The name of the variable.sequence
- The sequence to bind to the variable, may be null for an
empty sequence.
NullPointerException
- if name
is null
.XStaticContext.declareVariable(QName, QName)
void removeBinding(QName qname)
qname
- The name of the variable.
NullPointerException
- if qname
is null
.void bindFunction(QName qname, Method method)
bindFunction
that takes the instance object as a parameter for instance
methods.
qname
- The name of the function.method
- The method.
NullPointerException
- if qname
, or method
is null
.bindFunction(QName, Method, Object)
void bindFunction(QName qname, Method method, Object instanceObject)
qname
- The name of the function.method
- The method.instanceObject
- The object on which to call the method.
NullPointerException
- if any of qname
, method
,
or instanceObject
is null
.void removeFunctionBinding(QName qname, int arity)
qname
- The name of the function.arity
- The arity of the function. This is the number of parameters
that the function takes. This function for example (removeFunction
)
takes 2 parameters so its arity is 2.
NullPointerException
- if qname
is null
.
IllegalArgumentException
- if the arity
void bindCollation(String uri, Locale locale)
java.text.Collator
for the specified
java.util.Locale
.
A NullPointerException
is thrown if either
argument is null
. An IllegalArgumentException
is thrown if uri
is a relative URI reference or
is the Unicode code point collation URI.
Calling this method is equivalent to calling
bindCollation(uri, Collator.getInstance(locale))
With the exception of the Unicode code point collation URI,
if a stylesheet, query or XPath expression performs an
operation that requires a collation URI that has not been
bound to a Collator
in the XDynamicContext
,
the processor will throw an XProcessException
.
uri
- A collation URIlocale
- The locale whose Collator
will be associated with
the specified collation URI
IllegalArgumentException
- if the URI is not an absolute URI reference
or is the Unicode code point collation URI
NullPointerException
- if either the URI or the locale is a null
referenceXStaticContext.UNICODE_CODE_POINT_COLLATION_URI
void bindCollation(String uri, Collator collator)
java.text.Collator
.
A NullPointerException
is thrown if either
argument is null
. An IllegalArgumentException
is thrown if uri
is a relative URI reference or
is the Unicode code point collation URI.
With the exception of the Unicode code point collation URI,
if a stylesheet, query or XPath expression performs an
operation that requires a collation URI that has not been
bound to a Collator
in the XDynamicContext
,
the processor will throw an XProcessException
.
uri
- A collation URIcollator
- The Collator
that will be associated with
the specified collation URI
IllegalArgumentException
- if the URI is not an absolute URI reference
or is the Unicode code point collation URI
NullPointerException
- if either the URI or the locale is a null
referenceXStaticContext.UNICODE_CODE_POINT_COLLATION_URI
Collator getCollation(String uri)
Collator
associated with the given
collation URI.
uri
- The collation URI.
Collator
or null
if no collator has been bound to this the given URI.
NullPointerException
- if uri
is null.void removeCollationBinding(String uri)
Collator
associated with the given
collation URI.
uri
- The collation URI.
NullPointerException
- if uri
is null.Duration getImplicitTimeZone()
Duration
object.
null
if not set.void setImplicitTimeZone(Duration implicitTimeZone)
null
for the implicitTimeZone
to restore the default.
implicitTimeZone
- Time zone to be set as a Duration
object or null
.void setBaseOutputURI(String uri)
Sets the base URI to use when resolving result documents. Pass in null
for the uri
to restore the default. The default is
either the base URI for the primary result document if one is
passed into the execute
method or the current working directory.
This setting is XSLT specific.
uri
- The base output URI or null
.String getBaseOutputURI()
null
if not set.void setMessageHandler(XMessageHandler handler)
null
for the
handler
to restore the default message handling behaviour.
The default is to print messages to System.err
and
to also throw an XProcessException
for fatal errors.
handler
- The error handler or null
.XMessageHandler
XMessageHandler getMessageHandler()
null
if not set.XSourceResolver getSourceResolver()
null
if there is none.void setSourceResolver(XSourceResolver sourceResolver)
fn:doc
function and the XSLT
document
function. This source
resolver has no effect on documents that are resolved statically
such as XSLT imports and includes. For these documents the
XStaticContext.setSourceResolver
method should be used.
Pass in null
for the
sourceResolver
to restore the default source lookup
behaviour.
The default source resolution behavior is to interpret relative
URIs in terms of the base URI from the static context
if available or to interpret them as file:
paths
relative to the current working directory if the base URI is not
available. Absolute URIs are used unchanged.
sourceResolver
- The source document resolver or null
.XSourceResolver
XResultResolver getResultResolver()
null
if there is none.void setResultResolver(XResultResolver resultResolver)
Register a resolver for result documents. The resolver will
be invoked when the xsl:result-document instruction
is used in a XSLT stylesheet.
Pass in null
for
resultResolver
to restore the default result
resolution behaviour.
The default behavior is to use the base output URI to resolve
result documents.
This setting is XSLT specific.
resultResolver
- The result document resolver or null
.XResultResolver
void setFeature(String name, boolean value)
Set a feature for this dynamic context
.
Feature names should be fully qualified URI
s.
Implementations may define their own features.
Note: there are no currently defined features, this is for future use.
name
- Feature name.value
- Is feature state true
or false
.
NullPointerException
- if name
is null
.boolean getFeature(String name)
Get the state of the named feature.
Feature names should be fully qualified URI
s.
Implementations may define their own features.
Note: there are no currently defined features, this is for future use.
name
- Feature name.
NullPointerException
- if name
is null
.void setXSLTInitialTemplate(QName initialTemplate)
Specify a named template to use as the initial template in an XSLT transformation.
If a named template is not set, the initial template is determined by the initial mode, context node, and template matching rules
This setting is XSLT specific.
initialTemplate
- The name of the template to use as the
initial template, or null
to allow the initial
template to be determined by the template matching rules.QName getXSLTInitialTemplate()
null
if not set.void setXSLTInitialMode(QName initialMode)
Specify a mode to use as the initial mode in an XSLT transformation.
This setting is XSLT specific.
initialMode
- The name of the initial mode, or null
for the default mode.QName getXSLTInitialMode()
null
if not set.XCollectionResolver getCollectionResolver()
XCollectionResolver
if set,
otherwise null
.void setCollectionResolver(XCollectionResolver collectionResolver)
null
for the collectionResolver
to remove it.
If no collection resolver is registered then calls to fn:collection
will result in a recoverable error and the empty sequence is used
for the collection.
collectionResolver
- The collection resolver or null
.XCollectionResolver
void setUnparsedTextResolver(XUnparsedTextResolver unparsedTextResolver)
unparsed-text
function.
Pass in null
for the unparsedTextResolver
to restore the default unparsed text lookup behaviour.
The default unparsed text resolution behaviour is to interpret relative
URIs in terms of the base URI from the static context
if available or to interpret them as file:
paths
relative to the current working directory if the base URI is not
available. Absolute URIs are used unchanged.
unparsedTextResolver
- The unparsed text resolver or null
.XUnparsedTextResolver
XUnparsedTextResolver getUnparsedTextResolver()
null
if there is none.
|
IBM Copyright 2004-2008 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |