Class SaxonXQDynamicContext
- All Implemented Interfaces:
XQDynamicContext
- Direct Known Subclasses:
SaxonXQExpression,SaxonXQPreparedExpression
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbindAtomicValue(QName varname, String value, XQItemType type) Binds a value to the given external variable or the context item.voidbindBoolean(QName varname, boolean value, XQItemType type) Binds a value to the given external variable or the context item.voidbindByte(QName varname, byte value, XQItemType type) Binds a value to the given external variable or the context item.voidbindDocument(QName varname, InputStream value, String baseURI, XQItemType type) Binds a value to the given external variable or the context item.voidbindDocument(QName varname, Reader value, String baseURI, XQItemType type) Binds a value to the given external variable or the context item.voidbindDocument(QName varname, String value, String baseURI, XQItemType type) Binds a value to the given external variable or the context item.voidbindDocument(QName varname, XMLStreamReader value, XQItemType type) Binds a value to the given external variable or the context item.voidbindDocument(QName varname, Source value, XQItemType type) Binds a value to the given external variable or the context item from the givenSource.voidbindDouble(QName varname, double value, XQItemType type) Binds a value to the given external variable or the context item.voidbindFloat(QName varname, float value, XQItemType type) Binds a value to the given external variable or the context item.voidbindInt(QName varname, int value, XQItemType type) Binds a value to the given external variable or the context item.voidBinds a value to the given external variable.voidbindLong(QName varname, long value, XQItemType type) Binds a value to the given external variable or the context item.voidbindNode(QName varname, Node value, XQItemType type) Binds a value to the given external variable or the context item.voidbindObject(QName varname, Object value, XQItemType type) Binds a value to the given external variable or the context item.voidbindSequence(QName varname, XQSequence value) Binds a value to the given external variable or the context item.voidbindShort(QName varname, short value, XQItemType type) Binds a value to the given external variable or the context item.voidbindString(QName varname, String value, XQItemType type) Binds a value to the given external variable or the context item.protected abstract booleanexternalVariableExists(QName name) protected final Configurationprotected abstract SaxonXQDataFactoryprotected abstract DynamicQueryContextGets the implicit timezonevoidsetImplicitTimeZone(TimeZone implicitTimeZone) Sets the implicit timezoneMethods inherited from class com.saxonica.xqj.Closable
close, isClosed, setClosableContainer
-
Field Details
-
connection
-
-
Constructor Details
-
SaxonXQDynamicContext
public SaxonXQDynamicContext()
-
-
Method Details
-
getDynamicContext
-
getConfiguration
-
getDataFactory
- Throws:
XQException
-
externalVariableExists
-
bindAtomicValue
Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the casting fromxs:stringrules 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, anXQExceptionis thrown either by this method or during query evaluation.- Specified by:
bindAtomicValuein interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind tovalue- the lexical string value of the typetype- the item type of the bind- Throws:
XQException- if (1) any of the arguments arenull, (2) given type is not an atomic type, (3) the conversion of the value to an XDM instance failed, (4) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (5) in case of anXQPreparedExpression, the variable is not defined in the prolog of the expression, or (6) the expression is in a closed state
-
bindBoolean
Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, anXQExceptionis raised either by this method, or during query evaluation.- Specified by:
bindBooleanin interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- 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 casenullis specified- Throws:
XQException- if (1) thevarNameargument isnull, (2) the conversion of the value to an XDM instance failed, (3) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of anXQPreparedExpression, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state
-
bindByte
Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, anXQExceptionis raised either by this method, or during query evaluation.- Specified by:
bindBytein interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- 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 casenullis specified- Throws:
XQException- if (1) thevarNameargument isnull, (2) the conversion of the value to an XDM instance failed, (3) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of anXQPreparedExpression, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state
-
bindDocument
public void bindDocument(QName varname, InputStream value, String baseURI, XQItemType type) throws XQException Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item.If the value represents a well-formed XML document, it will be parsed and results in a document node. The kind of the input type must be
null,XQITEMKIND_DOCUMENT_ELEMENT, orXQITEMKIND_DOCUMENT_SCHEMA_ELEMENT.The value is converted into an instance of the specified type according to the rules defined in 14.3 Mapping a Java XML document to an XQuery document node, XQuery API for Java (XQJ) 1.0.
If the conversion fails, or if there is a mismatch between the static and dynamic types, an
XQExceptionis 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.- Specified by:
bindDocumentin interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- the value to be converted, cannot benullbaseURI- an optional base URI, can benull. 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. Ifnullis specified, it behaves as ifXQDataFactory.createDocumentElementType( XQDataFactory.createElementType(null, XQItemType.XQBASETYPE_XS_UNTYPED))were passed in as the type parameter. That is, the type represents the XQuery sequence typedocument-node(element(*, xs:untyped))- Throws:
XQException- if (1) thevarNameorvalueargument isnull, (2) the conversion of the value to an XDM instance failed, (3) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of anXQPreparedExpression, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state
-
bindDocument
public void bindDocument(QName varname, Reader value, String baseURI, XQItemType type) throws XQException Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item.If the value represents a well-formed XML document, it will be parsed and results in a document node. The kind of the input type must be
null,XQITEMKIND_DOCUMENT_ELEMENT, orXQITEMKIND_DOCUMENT_SCHEMA_ELEMENT.The value is converted into an instance of the specified type according to the rules defined in 14.3 Mapping a Java XML document to an XQuery document node, XQuery API for Java (XQJ) 1.0.
If the conversion fails, or if there is a mismatch between the static and dynamic types, an
XQExceptionis 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.- Specified by:
bindDocumentin interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- the value to be converted, cannot benullbaseURI- an optional base URI, can benull. 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. Ifnullis specified, it behaves as ifXQDataFactory.createDocumentElementType( XQDataFactory.createElementType(null, XQItemType.XQBASETYPE_XS_UNTYPED))were passed in as the type parameter. That is, the type represents the XQuery sequence typedocument-node(element(*, xs:untyped))- Throws:
XQException- if (1) thevarNameorvalueargument isnull, (2) the conversion of the value to an XDM instance failed, (3) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of anXQPreparedExpression, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state
-
bindDocument
Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item from the givenSource. An XQJ implementation must at least support the following implementations:javax.xml.transform.dom.DOMSourcejavax.xml.transform.sax.SAXSourcejavax.xml.transform.stream.StreamSource
If the value represents a well-formed XML document, it will result in a document node. The kind of the input type must be
null,XQITEMKIND_DOCUMENT_ELEMENT, orXQITEMKIND_DOCUMENT_SCHEMA_ELEMENT.The value is converted into an instance of the specified type according to the rules defined in 14.3 Mapping a Java XML document to an XQuery document node, XQuery API for Java (XQJ) 1.0.
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. If the conversion fails, or if there is a mismatch between the static and dynamic types, an
XQExceptionis raised either by this method, or during query evaluation.- Specified by:
bindDocumentin interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- the value to be converted, cannot benulltype- the type of the value for the created document node. Ifnullis specified, it behaves as ifXQDataFactory.createDocumentElementType( XQDataFactory.createElementType(null, XQItemType.XQBASETYPE_XS_UNTYPED))were passed in as the type parameter. That is, the type represents the XQuery sequence typedocument-node(element(*, xs:untyped))- Throws:
XQException- if (1) thevarNameorvalueargument isnull, (2) the conversion of the value to an XDM instance failed, (3) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of anXQPreparedExpression, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state
-
bindDocument
public void bindDocument(QName varname, String value, String baseURI, XQItemType type) throws XQException Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item.If the value represents a well-formed XML document, it will be parsed and results in a document node. The kind of the input type must be
null,XQITEMKIND_DOCUMENT_ELEMENT, orXQITEMKIND_DOCUMENT_SCHEMA_ELEMENT.The value is converted into an instance of the specified type according to the rules defined in 14.3 Mapping a Java XML document to an XQuery document node, XQuery API for Java (XQJ) 1.0.
If the conversion fails, or if there is a mismatch between the static and dynamic types, an
XQExceptionis 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.- Specified by:
bindDocumentin interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- the value to be converted, cannot benullbaseURI- an optional base URI, can benull. 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. Ifnullis specified, it behaves as ifXQDataFactory.createDocumentElementType( XQDataFactory.createElementType(null, XQItemType.XQBASETYPE_XS_UNTYPED))were passed in as the type parameter. That is, the type represents the XQuery sequence typedocument-node(element(*, xs:untyped))- Throws:
XQException- if (1) thevarNameorvalueargument isnull, (2) the conversion of the value to an XDM instance failed, (3) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of anXQPreparedExpression, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state
-
bindDocument
Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item.If the value represents a well-formed XML document, it results in a document node. The kind of the input type must be
null,XQITEMKIND_DOCUMENT_ELEMENTorXQITEMKIND_DOCUMENT_SCHEMA_ELEMENT.The value is converted into an instance of the specified type according to the rules defined in 14.3 Mapping a Java XML document to an XQuery document node, XQuery API for Java (XQJ) 1.0.
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. If the conversion fails, or if there is a mismatch between the static and dynamic types, an
XQExceptionis raised either by this method, or during query evaluation.- Specified by:
bindDocumentin interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- the value to be converted, cannot benulltype- the type of the value for the created document node. Ifnullis specified, it behaves as ifXQDataFactory.createDocumentElementType( XQDataFactory.createElementType(null, XQItemType.XQBASETYPE_XS_UNTYPED))were passed in as the type parameter. That is, the type represents the XQuery sequence typedocument-node(element(*, xs:untyped))- Throws:
XQException- if (1) thevarNameorvalueargument isnull, (2) the conversion of the value to an XDM instance failed, (3) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of anXQPreparedExpression, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state
-
bindDouble
Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, anXQExceptionis raised either by this method, or during query evaluations.- Specified by:
bindDoublein interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- 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 casenullis specified- Throws:
XQException- if (1) thevarNameargument isnull, (2) the conversion of the value to an XDM instance failed, (3) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of anXQPreparedExpression, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state
-
bindFloat
Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, anXQExceptionis raised either by this method, or during query evaluations.- Specified by:
bindFloatin interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- 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 casenullis specified- Throws:
XQException- if (1) thevarNameargument isnull, (2) the conversion of the value to an XDM instance failed, (3) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of anXQPreparedExpression, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state
-
bindInt
Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, anXQExceptionis raised either by this method, or during query evaluations.- Specified by:
bindIntin interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- 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 casenullis specified- Throws:
XQException- if (1) thevarNameargument isnull, (2) the conversion of the value to an XDM instance failed, (3) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of anXQPreparedExpression, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state
-
bindItem
Description copied from interface:XQDynamicContextBinds a value to the given external variable. The dynamic type of the value is derived from theXQItem. In case of a mismatch between the static and dynamic types, anXQExceptionis raised either by this method, or during query evaluation.- Specified by:
bindItemin interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- the value to be bound, cannot benull- Throws:
XQException- if (1) any of the arguments arenull, (2) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (3) in case of anXQPreparedExpression, 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 closed
-
bindLong
Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, anXQExceptionis raised either by this method, or during query evaluation.- Specified by:
bindLongin interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- 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 casenullis specified- Throws:
XQException- if (1) thevarNameargument isnull, (2) the conversion of the value to an XDM instance failed, (3) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of anXQPreparedExpression, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state
-
bindNode
Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, anXQExceptionis raised either by this method, or during query evaluation.- Specified by:
bindNodein interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- the value to be converted, cannot benulltype- the type of the value to be bound to the external variable. The default type of the value is used in casenullis specified- Throws:
XQException- if (1) thevarNameorvalueargument isnull, (2) the conversion of the value to an XDM instance failed, (3) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of anXQPreparedExpression, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state
-
bindObject
Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, anXQExceptionis raised either by this method, or during query evaluation.- Specified by:
bindObjectin interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- the value to be converted, cannot benulltype- the type of the value to be bound to the external variable. The default type of the value is used in casenullis specified- Throws:
XQException- if (1) thevarNameorvalueargument isnull, (2) the conversion of the value to an XDM instance failed, (3) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of anXQPreparedExpression, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state
-
bindSequence
Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item. The input sequence is consumed from its current position to the end, after which the input sequence's position will be set to point after the last item. The dynamic type of the value is derived from the items in the sequence. In case of a mismatch between the static and dynamic types, anXQExceptionis be raised either by this method, or during query evaluation.- Specified by:
bindSequencein interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- the value to be bound, cannot benull- Throws:
XQException- if (1) any of the arguments arenull, (2) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (3) in case of anXQPreparedExpression, 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 closed
-
bindShort
Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item. The value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0. If the conversion fails, or if there is a mismatch between the static and dynamic types, anXQExceptionis raised either by this method, or during query evaluation.- Specified by:
bindShortin interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- 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 casenullis specified- Throws:
XQException- if (1) thevarNameargument isnull, (2) the conversion of the value to an XDM instance failed, (3) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of anXQPreparedExpression, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state
-
bindString
Description copied from interface:XQDynamicContextBinds a value to the given external variable or the context item. The value is converted into an instance of the specified type, which must represent anxs:stringor a type derived by restriction fromxs:string. If the specified type isnull, it defaults toxs:string.
Subsequently the value is converted into an instance of the specified type according to the rule defined in 14.2 Mapping a Java Data Type to an XQuery Data Type, XQuery API for Java (XQJ) 1.0,. If the conversion fails, or if there is a mismatch between the static and dynamic types, an
XQExceptionis raised either by this method, or during query evaluation.- Specified by:
bindStringin interfaceXQDynamicContext- Parameters:
varname- the name of the external variable to bind to, cannot benullvalue- the value to be converted, cannot benulltype- the type of the value to be bound to the external variable. The default type,xs:string, is used in casenullis specified- Throws:
XQException- if (1) thevarNameorvalueargument isnull, (2) the conversion of the value to an XDM instance failed, (3) in case of anXQPreparedExpression, the dynamic type of the bound value is not compatible with the static type of the variable, (4) in case of anXQPreparedExpression, the variable is not defined in the prolog of the expression, or (5) if the expression is in a closed state
-
getImplicitTimeZone
Description copied from interface:XQDynamicContextGets the implicit timezone- Specified by:
getImplicitTimeZonein interfaceXQDynamicContext- Returns:
- the implicit timezone. This may have been set by an
application using the
setImplicitTimeZonemethod or provided by the implementation - Throws:
XQException- if the expression is in a closed state
-
setImplicitTimeZone
Description copied from interface:XQDynamicContextSets the implicit timezone- Specified by:
setImplicitTimeZonein interfaceXQDynamicContext- Parameters:
implicitTimeZone- time zone to be set- Throws:
XQException- if the expression is in a closed state
-