public interface OXQStaticContext
javax.xml.xquery.XQStaticContext.
Use method OXQView.getStaticContext(XQStaticContext) to access these extensions. For example:
OXQDataSource ds = new OXQDataSource(); XQConnection con = ds.getConnection(); XQStaticContext ctx = con.getStaticContext(); OXQStaticContext octx = OXQView.getStaticContext(ctx); ...
XQStaticContext| Modifier and Type | Method and Description |
|---|---|
void |
declareFunction(javax.xml.namespace.QName name, XQSequenceType[] parameterTypes, XQSequenceType returnType, OXQOptions options)
Declares an external function.
|
void |
declareFunction(javax.xml.namespace.QName name, XQSequenceType[] parameterTypes, XQSequenceType returnType, OXQOptions options, OXQAnnotation[] annotations)
Declares an external function.
|
void |
declareImport(OXQEntityKind entityKind, java.lang.String namespace, java.lang.String... locations)
Declares that a schema or module should be imported.
|
void |
declareVariable(javax.xml.namespace.QName name, XQSequenceType type)
Declares an external variable.
|
int |
getBindingTypeCheckMode()
Gets the type checking mode for external variable bindings.
|
OXQDecimalFormat |
getDecimalFormat(javax.xml.namespace.QName name)
Gets an
OXQDecimalFormat instance representing the the values for all decimal format properties. |
OXQEntityResolver |
getEntityResolver()
Gets the
OXQEntityResolver instance to be used during query processing. |
OXQFunctionMetaData[] |
getFunctions()
Gets the definitions of all external functions declared in this context.
|
java.lang.String[] |
getImportLocations(OXQEntityKind entityKind, java.lang.String namespace)
Gets the locations of a schema or module import.
|
java.lang.String[] |
getImportNamespaces(OXQEntityKind entityKind)
Gets the target namespaces of all schema or module imports currently declared.
|
java.lang.String |
getModuleURI()
Gets the module URI, if set in the static context, else the empty string.
|
int |
getProcessingMode()
Gets the processing mode.
|
OXQSerializationParameters |
getSerializationParameters()
Gets an
OXQSerializationParameters instance representing the the values for all serialization parameters. |
javax.xml.namespace.QName[] |
getVariableNames()
Gets the names of all external variables declared in this context.
|
XQSequenceType |
getVariableType(javax.xml.namespace.QName name)
Gets the type of an external variable declared in this context.
|
XQStaticContext |
getXQView()
Returns the
XQStaticContext instance corresponding to this instance. |
void |
setBindingTypeCheckMode(int mode)
Sets the type checking mode for external variable bindings.
|
void |
setDecimalFormat(javax.xml.namespace.QName name, OXQDecimalFormat format)
Adds a decimal format to this static context.
|
void |
setEntityResolver(OXQEntityResolver resolver)
Sets an
OXQEntityResolver instance to be used during query processing. |
void |
setModuleURI(java.lang.String moduleUri)
Sets the module URI in the static context.
|
void |
setProcessingMode(int mode)
Sets the processing mode.
|
void |
setSerializationParameters(OXQSerializationParameters params)
Sets the serialization parameters for this static context.
|
void |
undeclareFunction(javax.xml.namespace.QName name, int parameterCount)
Undeclares a previously declared external function.
|
void |
undeclareVariable(javax.xml.namespace.QName name)
Undeclares a previously declared external variable.
|
XQStaticContext getXQView()
XQStaticContext instance corresponding to this instance.int getBindingTypeCheckMode()
OXQConstants.BINDING_TYPE_CHECK_MODE_PRIME or OXQConstants.BINDING_TYPE_CHECK_MODE_FULLvoid setBindingTypeCheckMode(int mode)
throws XQException
OXQConstants.BINDING_TYPE_CHECK_MODE_PRIME, the XQuery processor assumes that the number of items bound to an external variable matches the type quantifier specified in the variable declaration and does not attempt to verify this assumption. By default, the processor will verify the type quantifier which can block streaming evaluation in some cases. declare variable $arg as element();
$arg[1]
Consider what happens if we bind (<a/>, <b/>) to this variable (a sequence of two elements). The binding mode is BINDING_TYPE_CHECK_MODE_FULL, this will result in a runtime error because "as element()" indicates there should be exactly 1 element bound to the variable. On the other hand, the binding mode is BINDING_TYPE_CHECK_MODE_PRIME, the XQuery processor will only ensure that the binding is an element but will not attempt to verify that there is exactly one element. The default value is OXQConstants.BINDING_TYPE_CHECK_MODE_FULL.
Note, the relaxed type checking behavior used in mode BINDING_TYPE_CHECK_MODE_PRIME does not conform to the XQuery 1.0 standard.
mode - the type checking mode. Must be either OXQConstants.BINDING_TYPE_CHECK_MODE_PRIME or OXQConstants.BINDING_TYPE_CHECK_MODE_FULLXQException - the specified mode is different from OXQConstants.BINDING_TYPE_CHECK_MODE_PRIME or OXQConstants.BINDING_TYPE_CHECK_MODE_FULLgetBindingTypeCheckMode()int getProcessingMode()
OXQConstants.PROCESSING_STATIC_ANALYSIS_ONLY to disable query optimization and plan generation. When in this mode, queries may not be executed. When the processing mode is OXQConstants.PROCESSING_FULL, queries may be prepared and executed. The default value is OXQConstants.PROCESSING_FULL.OXQConstants.PROCESSING_STATIC_ANALYSIS_ONLY or OXQConstants.PROCESSING_FULLvoid setProcessingMode(int mode)
throws XQException
mode - the processing mode. Must be either OXQConstants.PROCESSING_STATIC_ANALYSIS_ONLY or OXQConstants.PROCESSING_FULLXQException - the specified mode is different from OXQConstants.PROCESSING_STATIC_ANALYSIS_ONLY or OXQConstants.PROCESSING_FULLgetProcessingMode()java.lang.String getModuleURI()
nullsetModuleURI(String)void setModuleURI(java.lang.String moduleUri)
throws XQException
moduleUri is the empty string then the module URI setting will be cleared. The module URI will be used in error messages related to the main module. For example, by default a type error message in the main module might look something like the following:
line 10, column 11: XPTY0004: Invalid static type ...
"file:/myquery.xq", the error message would instead look something like:
file:/myquery.xq, line 10, column 11: XPTY0004: Invalid static type ...
moduleUri - the new moduleUri, or the empty string to make it undefined. Cannot be nullXQException - if a null module uri is specified, or given uri is not absoluteOXQEntityResolver getEntityResolver()
OXQEntityResolver instance to be used during query processing.void setEntityResolver(OXQEntityResolver resolver)
OXQEntityResolver instance to be used during query processing.resolver - the entity resolver to useOXQConnection.createEntityResolverFactory(Class), OXQEntityResolverFactoryvoid declareImport(OXQEntityKind entityKind, java.lang.String namespace, java.lang.String... locations) throws XQException
entityKind - must be either OXQEntityKind.MODULE or OXQEntityKind.SCHEMAnamespace - the target namespace of the schema or modulelocations - the location hintsXQException - if namespace is null, or if any element of locations is null, or if entityKind is not OXQEntityKind.MODULE or OXQEntityKind.SCHEMAgetImportLocations(OXQEntityKind, String), getImportNamespaces(OXQEntityKind), XQuery Schema Import Feature, XQuery Module Importjava.lang.String[] getImportNamespaces(OXQEntityKind entityKind) throws XQException
entityKind - must be either OXQEntityKind.MODULE or OXQEntityKind.SCHEMAnullXQException - if entityKind is not OXQEntityKind.MODULE or OXQEntityKind.SCHEMAdeclareImport(OXQEntityKind,String,String...), getImportLocations(OXQEntityKind,String)java.lang.String[] getImportLocations(OXQEntityKind entityKind, java.lang.String namespace) throws XQException
entityKind - must be either OXQEntityKind.MODULE or OXQEntityKind.SCHEMAnamespace - the target namespace of the schema to get the location hints fornullXQException - if namespace is null or unknown or if entityKind is not OXQEntityKind.MODULE or OXQEntityKind.SCHEMAdeclareImport(OXQEntityKind,String,String...), getImportNamespaces(OXQEntityKind)void declareVariable(javax.xml.namespace.QName name,
XQSequenceType type)
throws XQException
name - variable name. Cannot be nulltype - variable type. If null is specified then defaults to item()*XQException - if name is nulljavax.xml.namespace.QName[] getVariableNames()
nullXQSequenceType getVariableType(javax.xml.namespace.QName name) throws XQException
name - The name of the variable. Cannot be nullnullXQException - if variable name is null or unknownvoid undeclareVariable(javax.xml.namespace.QName name)
throws XQException
name - variable name. Cannot be nullXQException - if name is null, or the variable is unknownvoid declareFunction(javax.xml.namespace.QName name,
XQSequenceType[] parameterTypes,
XQSequenceType returnType,
OXQOptions options)
throws XQException
name - function name. Cannot be nullparameterTypes - types of parameters. Cannot be nullreturnType - output type. If null is specified then defaults to item()*options - additional options. May be nullXQException - if function name is null or any of parameter types is nullOXQConnection.createOptions()void declareFunction(javax.xml.namespace.QName name,
XQSequenceType[] parameterTypes,
XQSequenceType returnType,
OXQOptions options,
OXQAnnotation[] annotations)
throws XQException
name - function name. Cannot be nullparameterTypes - types of parameters. Cannot be nullreturnType - output type. If null is specified then defaults to item()*options - additional options. May be nullannotations - function annotations. May be nullXQException - if function name is null or any of parameter types is nullOXQConnection.createOptions(), OXQConnection.createAnnotation(QName, javax.xml.xquery.XQSequence), OXQFunctionMetaDataOXQFunctionMetaData[] getFunctions()
nullvoid undeclareFunction(javax.xml.namespace.QName name,
int parameterCount)
throws XQException
name - function name. Cannot be nullparameterCount - number of parametersXQException - if name is null, or the function is unknownOXQSerializationParameters getSerializationParameters()
OXQSerializationParameters instance representing the the values for all serialization parameters. The returned instance is a copy so setSerializationParameters(OXQSerializationParameters) must be used to change the serialization parameters of this static context.void setSerializationParameters(OXQSerializationParameters params) throws XQException
params - the serialization parameters. May not be nullXQException - if params is nullOXQDecimalFormat getDecimalFormat(javax.xml.namespace.QName name)
OXQDecimalFormat instance representing the the values for all decimal format properties. The returned instance is a copy so setDecimalFormat(QName, OXQDecimalFormat) must be used to change the serialization parameters of this static context.name - the name that maps to a decimal format, use null to get the unnamed decimal format.void setDecimalFormat(javax.xml.namespace.QName name,
OXQDecimalFormat format)
throws XQException
name - decimal format name.format - the decimal format. May not be nullXQException - if format is null