public abstract class SaxonXQDynamicContext extends Closable implements XQDynamicContext
Modifier and Type | Field and Description |
---|---|
protected SaxonXQConnection |
connection |
Constructor and Description |
---|
SaxonXQDynamicContext() |
Modifier and Type | Method and Description |
---|---|
void |
bindAtomicValue(QName varname,
String value,
XQItemType type)
Binds a value to the given external variable or the context item.
|
void |
bindBoolean(QName varname,
boolean value,
XQItemType type)
Binds a value to the given external variable or the context item.
|
void |
bindByte(QName varname,
byte value,
XQItemType type)
Binds a value to the given external variable or the context item.
|
void |
bindDocument(QName varname,
InputStream value,
String baseURI,
XQItemType type)
Binds a value to the given external variable or the context item.
|
void |
bindDocument(QName varname,
Reader value,
String baseURI,
XQItemType type)
Binds a value to the given external variable or the context item.
|
void |
bindDocument(QName varname,
Source value,
XQItemType type)
Binds a value to the given external variable or the context item
from the given
Source . |
void |
bindDocument(QName varname,
String value,
String baseURI,
XQItemType type)
Binds a value to the given external variable or the context item.
|
void |
bindDocument(QName varname,
XMLStreamReader value,
XQItemType type)
Binds a value to the given external variable or the context item.
|
void |
bindDouble(QName varname,
double value,
XQItemType type)
Binds a value to the given external variable or the context item.
|
void |
bindFloat(QName varname,
float value,
XQItemType type)
Binds a value to the given external variable or the context item.
|
void |
bindInt(QName varname,
int value,
XQItemType type)
Binds a value to the given external variable or the context item.
|
void |
bindItem(QName varname,
XQItem value)
Binds a value to the given external variable.
|
void |
bindLong(QName varname,
long value,
XQItemType type)
Binds a value to the given external variable or the context item.
|
void |
bindNode(QName varname,
Node value,
XQItemType type)
Binds a value to the given external variable or the context item.
|
void |
bindObject(QName varname,
Object value,
XQItemType type)
Binds a value to the given external variable or the context item.
|
void |
bindSequence(QName varname,
XQSequence value)
Binds a value to the given external variable or the context item.
|
void |
bindShort(QName varname,
short value,
XQItemType type)
Binds a value to the given external variable or the context item.
|
void |
bindString(QName varname,
String value,
XQItemType type)
Binds a value to the given external variable or the context item.
|
protected abstract boolean |
externalVariableExists(QName name) |
protected Configuration |
getConfiguration() |
protected abstract SaxonXQDataFactory |
getDataFactory() |
protected abstract DynamicQueryContext |
getDynamicContext() |
TimeZone |
getImplicitTimeZone()
Gets the implicit timezone
|
void |
setImplicitTimeZone(TimeZone implicitTimeZone)
Sets the implicit timezone
|
close, isClosed, setClosableContainer
protected SaxonXQConnection connection
protected abstract DynamicQueryContext getDynamicContext()
protected final Configuration getConfiguration()
protected abstract SaxonXQDataFactory getDataFactory() throws XQException
XQException
protected abstract boolean externalVariableExists(QName name)
public void bindAtomicValue(QName varname, String value, XQItemType type) throws XQException
XQDynamicContext
xs:string
rules outlined in
17.1.1 Casting from xs:string and xs:untypedAtomic, XQuery 1.0 and
XPath 2.0 Functions and Operators.
If the cast fails, or if there is a mismatch between the static and
dynamic types, an XQException
is thrown either by this
method or during query evaluation.bindAtomicValue
in interface XQDynamicContext
varname
- the name of the external variable to bind tovalue
- the lexical string value of the typetype
- the item type of the bindXQException
- if (1) any of the arguments are null
,
(2) given type is not an atomic type,
(3) the conversion of the value to an XDM instance failed,
(4) in case of an XQPreparedExpression
,
the dynamic type of the bound value is not compatible
with the static type of the variable,
(5) in case of an XQPreparedExpression
,
the variable is not defined in the prolog of the expression,
or (6) the expression is in a closed statepublic void bindBoolean(QName varname, boolean value, XQItemType type) throws XQException
XQDynamicContext
XQException
is raised either by this method, or during
query evaluation.bindBoolean
in interface XQDynamicContext
varname
- the name of the external variable to bind to, cannot be
null
value
- the value to be convertedtype
- the type of the value to be bound to the external variable.
The default type of the value is used in case null
is specifiedXQException
- if (1) the varName
argument
is null
, (2) the conversion of the value to an
XDM instance failed, (3) in case of an
XQPreparedExpression
, the dynamic type of the bound
value is not compatible with the static type of the variable,
(4) in case of an XQPreparedExpression
,
the variable is not defined in the prolog of the expression,
or (5) if the expression is in a closed statepublic void bindByte(QName varname, byte value, XQItemType type) throws XQException
XQDynamicContext
XQException
is raised either by this method, or
during query evaluation.bindByte
in interface XQDynamicContext
varname
- the name of the external variable to bind to, cannot be
null
value
- the value to be convertedtype
- the type of the value to be bound to the external variable.
The default type of the value is used in case null
is specifiedXQException
- if (1) the varName
argument
is null
, (2) the conversion of the value to an
XDM instance failed, (3) in case of an
XQPreparedExpression
, the dynamic type of the bound
value is not compatible with the static type of the variable,
(4) in case of an XQPreparedExpression
,
the variable is not defined in the prolog of the expression,
or (5) if the expression is in a closed statepublic void bindDocument(QName varname, InputStream value, String baseURI, XQItemType type) throws XQException
XQDynamicContext
null
,
XQITEMKIND_DOCUMENT_ELEMENT
, or
XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
.
XQException
is raised either by this
method, or during query evaluation. If the value is not well formed,
or if a kind of the input type other than the values list above is
specified, behavior is implementation defined and may raise an exception.bindDocument
in interface XQDynamicContext
varname
- the name of the external variable to bind to,
cannot be null
value
- the value to be converted, cannot be
null
baseURI
- an optional base URI, can be null
. It can
be used, for example, to resolve relative URIs and to
include in error messages.type
- the type of the value for the created
document node. If null
is specified,
it behaves as if
XQDataFactory.createDocumentElementType(
XQDataFactory.createElementType(null,
XQItemType.XQBASETYPE_XS_UNTYPED))
were passed in
as the type parameter. That is, the type represents the
XQuery sequence type document-node(element(*, xs:untyped))
XQException
- if (1) the varName
or value
argument is null
, (2) the
conversion of the value to an XDM instance failed,
(3) in case of an XQPreparedExpression
,
the dynamic type of the bound value is not compatible
with the static type of the variable, (4) in case of an
XQPreparedExpression
, the variable is not
defined in the prolog of the expression,
or (5) if the expression is in a closed statepublic void bindDocument(QName varname, Reader value, String baseURI, XQItemType type) throws XQException
XQDynamicContext
null
,
XQITEMKIND_DOCUMENT_ELEMENT
, or
XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
.
XQException
is raised either by this
method, or during query evaluation. If the value is not well formed,
or if a kind of the input type other than the values list above is
specified, behavior is implementation defined and may raise an exception.bindDocument
in interface XQDynamicContext
varname
- the name of the external variable to bind to,
cannot be null
value
- the value to be converted, cannot be
null
baseURI
- an optional base URI, can be null
. It can
be used, for example, to resolve relative URIs and to
include in error messages.type
- the type of the value for the created
document node. If null
is specified,
it behaves as if
XQDataFactory.createDocumentElementType(
XQDataFactory.createElementType(null,
XQItemType.XQBASETYPE_XS_UNTYPED))
were passed in
as the type parameter. That is, the type represents the
XQuery sequence type document-node(element(*, xs:untyped))
XQException
- if (1) the varName
or value
argument is null
, (2) the
conversion of the value to an XDM instance failed,
(3) in case of an XQPreparedExpression
,
the dynamic type of the bound value is not compatible
with the static type of the variable, (4) in case of an
XQPreparedExpression
, the variable is not
defined in the prolog of the expression,
or (5) if the expression is in a closed statepublic void bindDocument(QName varname, Source value, XQItemType type) throws XQException
XQDynamicContext
Source
. An XQJ
implementation must at least support the following implementations:
javax.xml.transform.dom.DOMSource
javax.xml.transform.sax.SAXSource
javax.xml.transform.stream.StreamSource
null
,
XQITEMKIND_DOCUMENT_ELEMENT
, or
XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
.
XQException
is raised either by this method, or during query evaluation.bindDocument
in interface XQDynamicContext
varname
- the name of the external variable to bind to, cannot
be null
value
- the value to be converted, cannot be null
type
- the type of the value for the created
document node. If null
is specified,
it behaves as if
XQDataFactory.createDocumentElementType(
XQDataFactory.createElementType(null,
XQItemType.XQBASETYPE_XS_UNTYPED))
were passed in
as the type parameter. That is, the type represents the
XQuery sequence type document-node(element(*, xs:untyped))
XQException
- if (1) the varName
or value
argument is null
, (2) the
conversion of the value to an XDM instance failed,
(3) in case of an XQPreparedExpression
,
the dynamic type of the bound value is not compatible
with the static type of the variable, (4) in case of an
XQPreparedExpression
, the variable is not
defined in the prolog of the expression,
or (5) if the expression is in a closed statepublic void bindDocument(QName varname, String value, String baseURI, XQItemType type) throws XQException
XQDynamicContext
null
,
XQITEMKIND_DOCUMENT_ELEMENT
, or
XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
.
XQException
is raised either by this
method, or during query evaluation. If the value is not well formed,
or if a kind of the input type other than the values list above is
specified, behavior is implementation defined and may raise an exception.bindDocument
in interface XQDynamicContext
varname
- the name of the external variable to bind to,
cannot be null
value
- the value to be converted, cannot be
null
baseURI
- an optional base URI, can be null
. It can
be used, for example, to resolve relative URIs and to
include in error messages.type
- the type of the value for the created
document node. If null
is specified,
it behaves as if
XQDataFactory.createDocumentElementType(
XQDataFactory.createElementType(null,
XQItemType.XQBASETYPE_XS_UNTYPED))
were passed in
as the type parameter. That is, the type represents the
XQuery sequence type document-node(element(*, xs:untyped))
XQException
- if (1) the varName
or value
argument is null
, (2) the
conversion of the value to an XDM instance failed,
(3) in case of an XQPreparedExpression
,
the dynamic type of the bound value is not compatible
with the static type of the variable, (4) in case of an
XQPreparedExpression
, the variable is not
defined in the prolog of the expression,
or (5) if the expression is in a closed statepublic void bindDocument(QName varname, XMLStreamReader value, XQItemType type) throws XQException
XQDynamicContext
null
,
XQITEMKIND_DOCUMENT_ELEMENT
or XQITEMKIND_DOCUMENT_SCHEMA_ELEMENT
.
XQException
is raised either by this method, or during
query evaluation.bindDocument
in interface XQDynamicContext
varname
- the name of the external variable to bind to, cannot
be null
value
- the value to be converted, cannot be null
type
- the type of the value for the created
document node. If null
is specified,
it behaves as if
XQDataFactory.createDocumentElementType(
XQDataFactory.createElementType(null,
XQItemType.XQBASETYPE_XS_UNTYPED))
were passed in
as the type parameter. That is, the type represents the
XQuery sequence type document-node(element(*, xs:untyped))
XQException
- if (1) the varName
or value
argument is null
, (2) the
conversion of the value to an XDM instance failed,
(3) in case of an XQPreparedExpression
,
the dynamic type of the bound value is not compatible
with the static type of the variable, (4) in case of an
XQPreparedExpression
, the variable is not
defined in the prolog of the expression,
or (5) if the expression is in a closed statepublic void bindDouble(QName varname, double value, XQItemType type) throws XQException
XQDynamicContext
XQException
is raised either by this method, or
during query evaluations.bindDouble
in interface XQDynamicContext
varname
- the name of the external variable to bind to, cannot be
null
value
- the value to be convertedtype
- the type of the value to be bound to the external variable.
The default type of the value is used in case null
is specifiedXQException
- if (1) the varName
argument
is null
, (2) the conversion of the value to an
XDM instance failed, (3) in case of an
XQPreparedExpression
, the dynamic type of the bound
value is not compatible with the static type of the variable,
(4) in case of an XQPreparedExpression
,
the variable is not defined in the prolog of the expression,
or (5) if the expression is in a closed statepublic void bindFloat(QName varname, float value, XQItemType type) throws XQException
XQDynamicContext
XQException
is raised either by this method, or
during query evaluations.bindFloat
in interface XQDynamicContext
varname
- the name of the external variable to bind to, cannot be
null
value
- the value to be convertedtype
- the type of the value to be bound to the external variable.
The default type of the value is used in case null
is specifiedXQException
- if (1) the varName
argument
is null
, (2) the conversion of the value to an
XDM instance failed, (3) in case of an
XQPreparedExpression
, the dynamic type of the bound
value is not compatible with the static type of the variable,
(4) in case of an XQPreparedExpression
,
the variable is not defined in the prolog of the expression,
or (5) if the expression is in a closed statepublic void bindInt(QName varname, int value, XQItemType type) throws XQException
XQDynamicContext
XQException
is raised either by this method, or
during query evaluations.bindInt
in interface XQDynamicContext
varname
- the name of the external variable to bind to, cannot be
null
value
- the value to be convertedtype
- the type of the value to be bound to the external variable.
The default type of the value is used in case null
is specifiedXQException
- if (1) the varName
argument
is null
, (2) the conversion of the value to an
XDM instance failed, (3) in case of an
XQPreparedExpression
, the dynamic type of the bound
value is not compatible with the static type of the variable,
(4) in case of an XQPreparedExpression
,
the variable is not defined in the prolog of the expression,
or (5) if the expression is in a closed statepublic void bindItem(QName varname, XQItem value) throws XQException
XQDynamicContext
XQItem
. In case of a mismatch
between the static and dynamic types, an XQException
is
raised either by this method, or during query evaluation.bindItem
in interface XQDynamicContext
varname
- the name of the external variable to bind to,
cannot be null
value
- the value to be bound, cannot be null
XQException
- if (1) any of the arguments are null
,
(2) in case of an XQPreparedExpression
,
the dynamic type of the bound value is not compatible
with the static type of the variable,
(3) in case of an XQPreparedExpression
,
the variable is not defined in the prolog of the
expression, (4) the expression is in a closed state,
or (5) the specified item is closedpublic void bindLong(QName varname, long value, XQItemType type) throws XQException
XQDynamicContext
XQException
is raised either by this method, or
during query evaluation.bindLong
in interface XQDynamicContext
varname
- the name of the external variable to bind to, cannot be
null
value
- the value to be convertedtype
- the type of the value to be bound to the external variable.
The default type of the value is used in case null
is specifiedXQException
- if (1) the varName
argument
is null
, (2) the conversion of the value to an
XDM instance failed, (3) in case of an
XQPreparedExpression
, the dynamic type of the bound
value is not compatible with the static type of the variable,
(4) in case of an XQPreparedExpression
,
the variable is not defined in the prolog of the expression,
or (5) if the expression is in a closed statepublic void bindNode(QName varname, Node value, XQItemType type) throws XQException
XQDynamicContext
XQException
is raised either by this method, or
during query evaluation.bindNode
in interface XQDynamicContext
varname
- the name of the external variable to bind to, cannot be
null
value
- the value to be converted, cannot be null
type
- the type of the value to be bound to the external variable.
The default type of the value is used in case null
is specifiedXQException
- if (1) the varName
or value
argument
is null
, (2) the conversion of the value to an
XDM instance failed, (3) in case of an
XQPreparedExpression
, the dynamic type of the bound
value is not compatible with the static type of the variable,
(4) in case of an XQPreparedExpression
,
the variable is not defined in the prolog of the expression,
or (5) if the expression is in a closed statepublic void bindObject(QName varname, Object value, XQItemType type) throws XQException
XQDynamicContext
XQException
is raised either by this method, or during
query evaluation.bindObject
in interface XQDynamicContext
varname
- the name of the external variable to bind to, cannot be
null
value
- the value to be converted, cannot be null
type
- the type of the value to be bound to the external variable.
The default type of the value is used in case null
is specifiedXQException
- if (1) the varName
or value
argument
is null
, (2) the conversion of the value to an
XDM instance failed, (3) in case of an
XQPreparedExpression
, the dynamic type of the bound
value is not compatible with the static type of the variable,
(4) in case of an XQPreparedExpression
,
the variable is not defined in the prolog of the expression,
or (5) if the expression is in a closed statepublic void bindSequence(QName varname, XQSequence value) throws XQException
XQDynamicContext
XQException
is be raised either by this method, or
during query evaluation.bindSequence
in interface XQDynamicContext
varname
- the name of the external variable to bind to, cannot be
null
value
- the value to be bound, cannot be null
XQException
- if (1) any of the arguments are null
,
(2) in case of an XQPreparedExpression
,
the dynamic type of the bound value is not compatible
with the static type of the variable,
(3) in case of an XQPreparedExpression
,
the variable is not defined in the prolog of
the expression, (4) the expression is in a closed
state, or (5) the specified sequence is closedpublic void bindShort(QName varname, short value, XQItemType type) throws XQException
XQDynamicContext
XQException
is raised either by this method, or
during query evaluation.bindShort
in interface XQDynamicContext
varname
- the name of the external variable to bind to, cannot be
null
value
- the value to be convertedtype
- the type of the value to be bound to the external variable.
The default type of the value is used in case null
is specifiedXQException
- if (1) the varName
argument
is null
, (2) the conversion of the value to an
XDM instance failed, (3) in case of an
XQPreparedExpression
, the dynamic type of the bound
value is not compatible with the static type of the variable,
(4) in case of an XQPreparedExpression
,
the variable is not defined in the prolog of the expression,
or (5) if the expression is in a closed statepublic void bindString(QName varname, String value, XQItemType type) throws XQException
XQDynamicContext
xs:string
or a type derived by restriction
from xs:string
. If the specified type is null
,
it defaults to xs:string
.XQException
is raised either by this
method, or during query evaluation.bindString
in interface XQDynamicContext
varname
- the name of the external variable to bind to,
cannot be null
value
- the value to be converted, cannot be
null
type
- the type of the value to be bound to the
external variable. The default type,
xs:string
, is used in case
null
is specifiedXQException
- if (1) the varName
or
value
argument is null
,
(2) the conversion of the value to an XDM
instance failed, (3) in case of an
XQPreparedExpression
, the dynamic
type of the bound value is not compatible with the
static type of the variable, (4) in case of an
XQPreparedExpression
, the variable
is not defined in the prolog of the expression,
or (5) if the expression is in a closed statepublic TimeZone getImplicitTimeZone() throws XQException
XQDynamicContext
getImplicitTimeZone
in interface XQDynamicContext
setImplicitTimeZone
method
or provided by the implementationXQException
- if the expression is in a closed statepublic void setImplicitTimeZone(TimeZone implicitTimeZone) throws XQException
XQDynamicContext
setImplicitTimeZone
in interface XQDynamicContext
implicitTimeZone
- time zone to be setXQException
- if the expression is in a closed stateCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.