com.ibm.xml.xapi

Interface XStaticContext


  1. public interface XStaticContext

Use the XStaticContext to override prepare time settings. These are settings used when preparing an expression, query or stylesheet. See the XFactory prepare methods and the XCompilationFactory compile methods that take an XStaticContext as an argument. The XFactory class has the method newStaticContext for creating new instances of XStaticContext.

Prepare time settings such as whether to use the interpreter or the compiler, the integer math mode to use, the names and types of external variables and functions, etc. are built directly into the executable and cannot be changed at execution time. Execution-time settings, on the other hand, such as the values of external variables and parameters, and the implementation of external functions are set using the XDynamicContext and may be different for each execution.

Examples of prepare time settings:

Not all settings are applicable for all languages. Refer to the documentation for the individual methods to see which languages the method applies to.

Settings in XStaticContext map to settings in the XPath, XQuery and XSLT static context as defined in the specifications:

See Also:
XFactory, XCompilationFactory, XFactory.newStaticContext(), XDynamicContext

Field Summary

Modifier and Type Field and Description
  1. static
  2. int
BOUNDARY_SPACE_PRESERVE
The constant indicating the the boundary-space policy for expression evaluation is to preserve white spaces.
  1. static
  2. int
BOUNDARY_SPACE_STRIP
The constant indicating the the boundary-space policy for expression evaluation is to strip white spaces
  1. static
  2. int
CONSTRUCTION_MODE_PRESERVE
The constant indicating that the type of a constructed element node is xs:anyType, and all attribute and element nodes copied during node construction retain their original types.
  1. static
  2. int
CONSTRUCTION_MODE_STRIP
The constant indicating that the type of a constructed element node is xs:untyped; all element nodes copied during node construction receive the type xs:untyped, and all attribute nodes copied during node construction receive the type xs:untypedAtomic.
  1. static
  2. int
COPY_NAMESPACES_MODE_INHERIT
The constant indicating that the inherit mode should be used in namespace binding assignment when an existing element node is copied by an element constructor, as described in 3.7.1 Direct Element Constructors, XQuery 1.0: An XML Query Language
  1. static
  2. int
COPY_NAMESPACES_MODE_NO_INHERIT
The constant indicating that the no-inherit mode should be used in namespace binding assignment when an existing element node is copied by an element constructor, as described in 3.7.1 Direct Element Constructors, XQuery 1.0: An XML Query Language
  1. static
  2. int
COPY_NAMESPACES_MODE_NO_PRESERVE
The constant indicating that the no-preserve mode should be used in namespace binding assignment when an existing element node is copied by an element constructor, as described in 3.7.1 Direct Element Constructors, XQuery 1.0: An XML Query Language
  1. static
  2. int
COPY_NAMESPACES_MODE_PRESERVE
The constant indicating that the preserve mode should be used in namespace binding assignment when an existing element node is copied by an element constructor, as described in 3.7.1 Direct Element Constructors, XQuery 1.0: An XML Query Language
  1. static
  2. int
DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_GREATEST
The constant indicating that ordering of empty sequences and NaN values as keys in an order by clause in a FLWOR expression is "greatest".
  1. static
  2. int
DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_LEAST
The constant indicating that ordering of empty sequences and NaN values as keys in an order by clause in a FLWOR expression is "least".
  1. static
  2. int
INTEGER_MATH_MODE_ARBITRARY_PRECISION
The constant indicating that xs:integer values should support an arbitrary number of digits of precision.
  1. static
  2. int
INTEGER_MATH_MODE_LIMITED_PRECISION
The constant indicating that xs:integer values need only support the minimum precision required for a minimally conforming processor (18 digits).
  1. static
  2. int
INTEGER_MATH_MODE_OVERFLOW_DETECTION
The constant indicating that xs:integer values need only support the minimum precision required for a minimally conforming processor (18 digits) but any overflow condition should be detected and error FOAR0002 raised.
  1. static
  2. int
ORDERING_MODE_ORDERED
The constant indicating that ordered results are to be returned by certain path expressions, union, intersect, and except expressions, and FLWOR expressions that have no order by clause.
  1. static
  2. int
ORDERING_MODE_UNORDERED
The constant indicating that unordered results are to be returned by certain path expressions, union, intersect, and except expressions, and FLWOR expressions that have no order by clause.
  1. static
  2. java.lang.String
UNICODE_CODE_POINT_COLLATION_URI
Constant definition of the Unicode code point collation URI.
  1. static
  2. int
XPATH_LATEST_VERSION
Constant for latest version.
  1. static
  2. int
XPATH1_0_BC_COMPATIBILITY
Constant for 1.0 backwards compatibility as defined in the XPath 2.0 specification.
  1. static
  2. int
XPATH2_0_PURE_COMPATIBILITY
Constant for pure 2.0 behaviour for XPath (no backwards compatibility).

Method Summary

Modifier and Type Method and Description
  1. void
declareFunction(javax.xml.namespace.QName name,javax.xml.namespace.QName type,javax.xml.namespace.QName... argTypes)
Add a function declaration where the return and argument values are single items.
  1. void
declareFunction(javax.xml.namespace.QName name,XSequenceType type,XSequenceType... argTypes)
Add a function declaration where the return and argument values are sequences.
  1. void
declareNamespace(java.lang.String prefix,java.lang.String uri)
Declares a namespace prefix and associates it with a namespace URI.
  1. void
declareVariable(javax.xml.namespace.QName name,javax.xml.namespace.QName type)
Add a variable binding to the static context for a single item.
  1. void
declareVariable(javax.xml.namespace.QName name,XSequenceType type)
Add a variable binding to the static context.
  1. java.lang.String
getBaseURI()
Get the base URI, if set, otherwise null.
  1. int
getBoundarySpacePolicy()
Get the boundary-space policy.
  1. int
getConstructionMode()
Get the construction mode.
  1. int
getCopyNamespacesModeInherit()
Get the inherit part of the copy-namespaces mode.
  1. int
getCopyNamespacesModePreserve()
Get the preserve part of the copy-namespaces mode.
  1. java.lang.String
getDefaultCollation()
Gets the URI of the default collation.
  1. java.lang.String
getDefaultCollationForXSLSort()
Gets the URI of the default collation URI used in an XSLT stylesheet by any xsl:sort element that does not have any collation, lang or case-order attributes, as set by a call to setDefaultCollationForXSLSort(String).
  1. java.lang.String
getDefaultElementTypeNamespace()
Gets the URI of the default element/type namespace, or the empty string if not set.
  1. java.lang.String
getDefaultFunctionNamespace()
Gets the URI of the default function namespace, or the empty string if not set.
  1. int
getDefaultOrderForEmptySequences()
Get the default order for empty sequences.
  1. boolean
getFeature(java.lang.String name)
Get the state of the named feature.
  1. XSequenceType[]
getFunctionArgTypes(javax.xml.namespace.QName name,int arity)
Get the function argument types.
  1. XSequenceType
getFunctionReturnType(javax.xml.namespace.QName name,int arity)
Get the function return type.
  1. int
getIntegerMathMode()
Get the integer math mode, which is a constant representing the level of precision required and whether overflow detection is required when working with xs:integer values.
  1. XMessageHandler
getMessageHandler()
Get the static message handler.
  1. XModuleResolver
getModuleResolver()
Get the registered resolver for XQuery modules.
  1. java.util.Enumeration<java.lang.String>
getNamespacePrefixes(java.lang.String namespaceURI)
Get all prefixes bound to a URI in the current scope.
  1. java.lang.String
getNamespaceURI(java.lang.String prefix)
Retrieves the namespace URI associated with the given prefix.
  1. int
getOrderingMode()
Get the ordering mode.
  1. XSourceResolver
getSourceResolver()
Get the registered resolver for source documents.
  1. boolean
getUseCompiler()
Get the use compiler setting.
  1. XSequenceType
getVariableType(javax.xml.namespace.QName name)
Get the type of a variable binding.
  1. int
getXPathCompatibilityMode()
Get the XPath 1.0 compatibility mode.
  1. void
setBaseURI(java.lang.String uri)
Set the base URI.
  1. void
setBoundarySpacePolicy(int policy)
Set the boundary-space policy.
  1. void
setConstructionMode(int mode)
Set the construction mode.
  1. void
setCopyNamespacesModeInherit(int mode)
Set the inherit part of the copy-namespaces mode.
  1. void
setCopyNamespacesModePreserve(int mode)
Set the preserve part of the copy namespaces mode.
  1. void
setDefaultCollation(java.lang.String uri)
Sets the default collation property of the static context.
  1. void
setDefaultCollationForXSLSort(java.lang.String uri)
Sets the collation URI used in an XSLT stylesheet by any xsl:sort element that does not have any collation, lang or case-order attributes.
  1. void
setDefaultElementTypeNamespace(java.lang.String uri)
Sets the URI of the default element/type namespace.
  1. void
setDefaultFunctionNamespace(java.lang.String uri)
Sets the URI of the default function namespace, the empty string to make it unspecified.
  1. void
setDefaultOrderForEmptySequences(int order)
Set the default order for empty sequences.
  1. void
setFeature(java.lang.String name,boolean value)
Set a feature for this static context.
  1. void
setIntegerMathMode(int mode)
Set the integer math mode, which is a constant representing the level of precision required and whether overflow detection is required when working with xs:integer values.
  1. void
setMessageHandler(XMessageHandler handler)
Set a message handler to process static errors and messages.
  1. void
setModuleResolver(XModuleResolver moduleResolver)
Register a resolver for XQuery modules.
  1. void
setOrderingMode(int mode)
Set the ordering mode.
  1. void
setSourceResolver(XSourceResolver sourceResolver)
Register a URI resolver for source documents.
  1. void
setUseCompiler(boolean value)
Set whether to use the compiler when preparing an expression (as opposed to the interpreter).
  1. void
setXPathCompatibilityMode(int mode)
Set the XPath 1.0 compatibility mode.

Field Detail

BOUNDARY_SPACE_PRESERVE

  1. static final int BOUNDARY_SPACE_PRESERVE
The constant indicating the the boundary-space policy for expression evaluation is to preserve white spaces.
See Also:

BOUNDARY_SPACE_STRIP

  1. static final int BOUNDARY_SPACE_STRIP
The constant indicating the the boundary-space policy for expression evaluation is to strip white spaces
See Also:

CONSTRUCTION_MODE_PRESERVE

  1. static final int CONSTRUCTION_MODE_PRESERVE
The constant indicating that the type of a constructed element node is xs:anyType, and all attribute and element nodes copied during node construction retain their original types.
See Also:

CONSTRUCTION_MODE_STRIP

  1. static final int CONSTRUCTION_MODE_STRIP
The constant indicating that the type of a constructed element node is xs:untyped; all element nodes copied during node construction receive the type xs:untyped, and all attribute nodes copied during node construction receive the type xs:untypedAtomic.
See Also:

ORDERING_MODE_ORDERED

  1. static final int ORDERING_MODE_ORDERED
The constant indicating that ordered results are to be returned by certain path expressions, union, intersect, and except expressions, and FLWOR expressions that have no order by clause.
See Also:

ORDERING_MODE_UNORDERED

  1. static final int ORDERING_MODE_UNORDERED
The constant indicating that unordered results are to be returned by certain path expressions, union, intersect, and except expressions, and FLWOR expressions that have no order by clause.
See Also:

DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_GREATEST

  1. static final int DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_GREATEST
The constant indicating that ordering of empty sequences and NaN values as keys in an order by clause in a FLWOR expression is "greatest". See 3.8.3 Order By and Return Clauses, XQuery 1.0: An XML Query Language for details.
See Also:

DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_LEAST

  1. static final int DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_LEAST
The constant indicating that ordering of empty sequences and NaN values as keys in an order by clause in a FLWOR expression is "least". See 3.8.3 Order By and Return Clauses, XQuery 1.0: An XML Query Language for details.
See Also:

COPY_NAMESPACES_MODE_PRESERVE

  1. static final int COPY_NAMESPACES_MODE_PRESERVE
The constant indicating that the preserve mode should be used in namespace binding assignment when an existing element node is copied by an element constructor, as described in 3.7.1 Direct Element Constructors, XQuery 1.0: An XML Query Language
See Also:

COPY_NAMESPACES_MODE_NO_PRESERVE

  1. static final int COPY_NAMESPACES_MODE_NO_PRESERVE
The constant indicating that the no-preserve mode should be used in namespace binding assignment when an existing element node is copied by an element constructor, as described in 3.7.1 Direct Element Constructors, XQuery 1.0: An XML Query Language
See Also:

COPY_NAMESPACES_MODE_INHERIT

  1. static final int COPY_NAMESPACES_MODE_INHERIT
The constant indicating that the inherit mode should be used in namespace binding assignment when an existing element node is copied by an element constructor, as described in 3.7.1 Direct Element Constructors, XQuery 1.0: An XML Query Language
See Also:

COPY_NAMESPACES_MODE_NO_INHERIT

  1. static final int COPY_NAMESPACES_MODE_NO_INHERIT
The constant indicating that the no-inherit mode should be used in namespace binding assignment when an existing element node is copied by an element constructor, as described in 3.7.1 Direct Element Constructors, XQuery 1.0: An XML Query Language
See Also:

INTEGER_MATH_MODE_LIMITED_PRECISION

  1. static final int INTEGER_MATH_MODE_LIMITED_PRECISION
The constant indicating that xs:integer values need only support the minimum precision required for a minimally conforming processor (18 digits).
See Also:

INTEGER_MATH_MODE_ARBITRARY_PRECISION

  1. static final int INTEGER_MATH_MODE_ARBITRARY_PRECISION
The constant indicating that xs:integer values should support an arbitrary number of digits of precision. No overflow should occur.
See Also:

INTEGER_MATH_MODE_OVERFLOW_DETECTION

  1. static final int INTEGER_MATH_MODE_OVERFLOW_DETECTION
The constant indicating that xs:integer values need only support the minimum precision required for a minimally conforming processor (18 digits) but any overflow condition should be detected and error FOAR0002 raised.
See Also:

XPATH_LATEST_VERSION

  1. static final int XPATH_LATEST_VERSION
Constant for latest version. Currently this is the same as XPATH2_0_PURE_COMPATIBILITY.
See Also:

XPATH1_0_BC_COMPATIBILITY

  1. static final int XPATH1_0_BC_COMPATIBILITY
Constant for 1.0 backwards compatibility as defined in the XPath 2.0 specification.
See Also:

XPATH2_0_PURE_COMPATIBILITY

  1. static final int XPATH2_0_PURE_COMPATIBILITY
Constant for pure 2.0 behaviour for XPath (no backwards compatibility). This is the default.
See Also:

UNICODE_CODE_POINT_COLLATION_URI

  1. static final java.lang.String UNICODE_CODE_POINT_COLLATION_URI
Constant definition of the Unicode code point collation URI.
See Also:

Method Detail

getNamespaceURI

  1. java.lang.String getNamespaceURI( java.lang.String prefix)
Retrieves the namespace URI associated with the given prefix.
Parameters:
prefix - The prefix. Cannot be null.
Returns:
The namespace URI, or null if the prefix is unknown.
Throws:
java.lang.NullPointerException - if prefix is null.

declareNamespace

  1. void declareNamespace(java.lang.String prefix,
  2. java.lang.String uri)
Declares a namespace prefix and associates it with a namespace URI. If the namespace URI is the empty string, the prefix is removed from the in-scope namespace definitions.
Parameters:
prefix - The prefix. Cannot be null.
uri - The namespace URI. An empty string undeclares the specified prefix. Cannot be null.
Throws:
java.lang.NullPointerException - if prefix or uri is null.

getDefaultElementTypeNamespace

  1. java.lang.String getDefaultElementTypeNamespace( )
Gets the URI of the default element/type namespace, or the empty string if not set.

This setting does not apply to XSLT which uses the [xsl:]xpath-default-namespace attribute to set the default element/type namespace.

Returns:
The URI of the default element/type namespace, if set, otherwise the empty string.

setDefaultElementTypeNamespace

  1. void setDefaultElementTypeNamespace( java.lang.String uri)
Sets the URI of the default element/type namespace. Use the empty string to make it unspecified. The default is the empty string.

This setting does not apply to XSLT which uses the [xsl:]xpath-default-namespace attribute to set the default element/type namespace.

Parameters:
uri - The namespace URI of the default element/type namespace, or the empty string to make it unspecified. Cannot be null.
Throws:
java.lang.NullPointerException - if uri is null.

getDefaultFunctionNamespace

  1. java.lang.String getDefaultFunctionNamespace( )
Gets the URI of the default function namespace, or the empty string if not set.

This setting does not apply to XSLT which uses the standard function namespace defined in Functions and Operators for the default function namespace.

Returns:
The URI of the default function namespace, otherwise the empty string. Cannot be null.

setDefaultFunctionNamespace

  1. void setDefaultFunctionNamespace( java.lang.String uri)
Sets the URI of the default function namespace, the empty string to make it unspecified. The default is "http://www.w3.org/2005/xpath-functions".

This setting does not apply to XSLT which uses the standard function namespace defined in Functions and Operators for the default function namespace.

Parameters:
uri - The namespace URI of the default function namespace, or the empty string to make it unspecified. Cannot be null.
Throws:
java.lang.NullPointerException - if uri is null.

getDefaultCollation

  1. java.lang.String getDefaultCollation( )
Gets the URI of the default collation.
Returns:
The URI of the default collation.

setDefaultCollation

  1. void setDefaultCollation(java.lang.String uri)
Sets the default collation property of the static context. By default, the value is the Unicode codepoint collation URI. The value must not be a relative URI reference.

If a string comparison operation does not specify a collation URI explicitly, and there is no default collation URI explicitly declared in the XSLT stylesheet or XQuery expression that is in scope for the operation, the default collation URI from the XStaticContext is used as the collation URI for the operation.

For an XPath expression, the default collation URI from the XStaticContext is always used as the collation URI for a string comparison operation that does not specify a collation URI explicitly.

Parameters:
uri - The URI reference for the default collation URI
Throws:
java.lang.NullPointerException - if uri is null
java.lang.IllegalArgumentException - if uri is a relative URI reference
See Also:

getDefaultCollationForXSLSort

  1. java.lang.String getDefaultCollationForXSLSort( )
Gets the URI of the default collation URI used in an XSLT stylesheet by any xsl:sort element that does not have any collation, lang or case-order attributes, as set by a call to setDefaultCollationForXSLSort(String).
Returns:
The URI of the default collation for xsl:sort elements
See Also:

setDefaultCollationForXSLSort

  1. void setDefaultCollationForXSLSort( java.lang.String uri)
Sets the collation URI used in an XSLT stylesheet by any xsl:sort element that does not have any collation, lang or case-order attributes.

By default, the collation used for such an xsl:sort element is not determined by the default collation property of the static context; instead, unless overridden by a call to this method, the collation selected for such an xsl:sort element is the collation associated with the default Locale as determined by calling java.util.Locale.getDefault()

Parameters:
uri - The URI reference for the default collation URI for xsl:sort. A null reference restores the usual default behaviour
Throws:
java.lang.IllegalArgumentException - if uri is a relative URI reference

getConstructionMode

  1. int getConstructionMode()
Get the construction mode.

This setting is XQuery specific.

Returns:
The construction mode value. One of: CONSTRUCTION_MODE_PRESERVE, CONSTRUCTION_MODE_STRIP

setConstructionMode

  1. void setConstructionMode(int mode)
Set the construction mode. The default is CONSTRUCTION_MODE_PRESERVE.

This setting is XQuery specific.

Parameters:
mode - The construction mode value. One of: CONSTRUCTION_MODE_PRESERVE, CONSTRUCTION_MODE_STRIP.
Throws:
java.lang.IllegalArgumentException - if mode is not one of: CONSTRUCTION_MODE_PRESERVE, CONSTRUCTION_MODE_STRIP.

getOrderingMode

  1. int getOrderingMode()
Get the ordering mode.

This setting is XQuery specific.

Returns:
The ordering mode value. One of: ORDERING_MODE_ORDERED, ORDERING_MODE_UNORDERED.

setOrderingMode

  1. void setOrderingMode(int mode)
Set the ordering mode. The default is ORDERING_MODE_ORDERED.

This setting is XQuery specific.

Parameters:
mode - The ordering mode value. One of: ORDERING_MODE_ORDERED, ORDERING_MODE_UNORDERED.
Throws:
java.lang.IllegalArgumentException - if mode is not one of: ORDERING_MODE_ORDERED, ORDERING_MODE_UNORDERED.

getDefaultOrderForEmptySequences

  1. int getDefaultOrderForEmptySequences( )
Get the default order for empty sequences.

This setting is XQuery specific.

Returns:
The default order for empty sequences value. One of: DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_GREATEST, DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_LEAST.

setDefaultOrderForEmptySequences

  1. void setDefaultOrderForEmptySequences( int order)
Set the default order for empty sequences. The default is DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_LEAST.

This setting is XQuery specific.

Parameters:
order - The default order for empty sequences. One of: DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_GREATEST, DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_LEAST.
Throws:
java.lang.IllegalArgumentException - if order is not one of: DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_GREATEST, DEFAULT_ORDER_FOR_EMPTY_SEQUENCES_LEAST.

getBoundarySpacePolicy

  1. int getBoundarySpacePolicy()
Get the boundary-space policy.

This setting is XQuery specific.

Returns:
The boundary-space policy value. One of: BOUNDARY_SPACE_PRESERVE, BOUNDARY_SPACE_STRIP.

setBoundarySpacePolicy

  1. void setBoundarySpacePolicy(int policy)
Set the boundary-space policy. The default is BOUNDARY_SPACE_STRIP.

This setting is XQuery specific.

Parameters:
policy - The boundary space policy. One of: BOUNDARY_SPACE_PRESERVE, BOUNDARY_SPACE_STRIP.
Throws:
java.lang.IllegalArgumentException - if policy is not one of: BOUNDARY_SPACE_PRESERVE, BOUNDARY_SPACE_STRIP.

getCopyNamespacesModePreserve

  1. int getCopyNamespacesModePreserve( )
Get the preserve part of the copy-namespaces mode.

This setting is XQuery specific.

Returns:
The copy-namespaces preserve mode value. One of: COPY_NAMESPACES_MODE_PRESERVE, COPY_NAMESPACES_MODE_NO_PRESERVE.

setCopyNamespacesModePreserve

  1. void setCopyNamespacesModePreserve( int mode)
Set the preserve part of the copy namespaces mode. The default is COPY_NAMESPACES_MODE_PRESERVE.

This setting is XQuery specific.

Parameters:
mode - The copy-namespaces preserve mode value. One of: COPY_NAMESPACES_MODE_PRESERVE, COPY_NAMESPACES_MODE_NO_PRESERVE.
Throws:
java.lang.IllegalArgumentException - if mode is not one of: COPY_NAMESPACES_MODE_PRESERVE, COPY_NAMESPACES_MODE_NO_PRESERVE.

getCopyNamespacesModeInherit

  1. int getCopyNamespacesModeInherit( )
Get the inherit part of the copy-namespaces mode.

This setting is XQuery specific.

Returns:
The copy-namespaces inherit mode value. One of: COPY_NAMESPACES_MODE_INHERIT, COPY_NAMESPACES_MODE_NO_INHERIT.

setCopyNamespacesModeInherit

  1. void setCopyNamespacesModeInherit( int mode)
Set the inherit part of the copy-namespaces mode. The default is COPY_NAMESPACES_MODE_INHERIT.

This setting is XQuery specific.

Parameters:
mode - The copy-namespaces inherit mode value. One of: COPY_NAMESPACES_MODE_INHERIT, COPY_NAMESPACES_MODE_NO_INHERIT.
Throws:
java.lang.IllegalArgumentException - if mode is not one of: COPY_NAMESPACES_MODE_INHERIT, COPY_NAMESPACES_MODE_NO_INHERIT.

getBaseURI

  1. java.lang.String getBaseURI()
Get the base URI, if set, otherwise null.
Returns:
The base URI, if set, otherwise null.

setBaseURI

  1. void setBaseURI(java.lang.String uri)
Set the base URI. Pass in null for the uri to restore the default. The default is the base URI of the expression, query, or stylesheet if available. If not available, the current working directory is used.
Parameters:
uri - The new base URI, or null.

getSourceResolver

  1. XSourceResolver getSourceResolver( )
Get the registered resolver for source documents.
Returns:
The XSourceResolver if set, otherwise null.

setSourceResolver

  1. void setSourceResolver(XSourceResolver sourceResolver)
Register a URI resolver for source documents. This source resolver only affects documents that are resolved statically such as XSLT imports and includes. Use the XDynamicContext.setSourceResolver method for documents that are resolved dynamically such as for the fn:doc function. Pass in null for the sourceResolver to restore the default source lookup behaviour. The default source resolution behavior is to use the base URI of the expression, query, or stylesheet if available to resolve imports and includes. If the base URI is not available, the current working directory is used.
Parameters:
sourceResolver - The source resolver or null.
See Also:

getXPathCompatibilityMode

  1. int getXPathCompatibilityMode()
Get the XPath 1.0 compatibility mode.
Returns:
The XPath compatibility mode, one of: XPATH2_0_PURE_COMPATIBILITY, XPATH1_0_BC_COMPATIBILITY.

setXPathCompatibilityMode

  1. void setXPathCompatibilityMode( int mode)
Set the XPath 1.0 compatibility mode. The default is XPATH2_0_PURE_COMPATIBILITY.
Parameters:
mode - The XPath compatibility mode, one of: XPATH2_0_PURE_COMPATIBILITY, XPATH1_0_BC_COMPATIBILITY, XPATH_LATEST_VERSION.
Throws:
java.lang.IllegalArgumentException - if mode is not one of: XPATH2_0_PURE_COMPATIBILITY, XPATH1_0_BC_COMPATIBILITY, XPATH_LATEST_VERSION.

getNamespacePrefixes

  1. java.util.Enumeration<java.lang.String> getNamespacePrefixes( java.lang.String namespaceURI)
Get all prefixes bound to a URI in the current scope.
Parameters:
namespaceURI - URI of namespace to look up.
Returns:
Enumerator for all prefixes bound to namespaceURI in the current scope.

declareFunction

  1. void declareFunction(javax.xml.namespace.QName name,
  2. javax.xml.namespace.QName type,
  3. javax.xml.namespace.QName... argTypes)
Add a function declaration where the return and argument values are single items. Atomic types (simple types excluding lists and unions) indicate single atomic items. Non-atomic types (complex types, lists, or unions) indicate single elements (not nillable) of the given type. Note that this simply declares the function and a Method object for the function must also be bound to the dynamic context at execution-time. See XDynamicContext.bindFunction(). Predefined QNames for built-in types can be found in XTypeConstants. This method cannot be used to override built-in functions.
Parameters:
name - The name of the function.
type - The return type of the function.
argTypes - The argument types for the function.
Throws:
java.lang.NullPointerException - if any of name, type, or argTypes is null.
java.lang.IllegalArgumentException - if the type or any of the argTypes are undefined.
See Also:

declareFunction

  1. void declareFunction(javax.xml.namespace.QName name,
  2. XSequenceType type,
  3. XSequenceType... argTypes)
Add a function declaration where the return and argument values are sequences. Note that this simply declares the function and a Method object for the function must also be bound to the dynamic context. See XDynamicContext.bindFunction(). The XSequenceTypeFactory can be used to create sequence types. This method cannot be used to override built-in functions.
Parameters:
name - The name of the function.
type - the return type of the function.
argTypes - the argument types for the function.
Throws:
java.lang.NullPointerException - if any of name, type, or argTypes is null.
See Also:

getFunctionReturnType

  1. XSequenceType getFunctionReturnType( javax.xml.namespace.QName name,
  2. int arity)
Get the function return type. This method cannot be used to get the return type of built-in functions.
Parameters:
name - The name of the function.
arity - The arity (number of parameters) of the function.
Returns:
The return type of the function.
Throws:
java.lang.NullPointerException - if name is null.
java.lang.IllegalArgumentException - if the arity

getFunctionArgTypes

  1. XSequenceType[] getFunctionArgTypes( javax.xml.namespace.QName name,
  2. int arity)
Get the function argument types. This method cannot be used to get the argument types of built-in functions.
Parameters:
name - The name of the Function.
arity - The arity (number of parameters) of the function.
Returns:
The argument types.
Throws:
java.lang.NullPointerException - if name is null.
java.lang.IllegalArgumentException - if the arity

declareVariable

  1. void declareVariable(javax.xml.namespace.QName name,
  2. javax.xml.namespace.QName type)
Add a variable binding to the static context for a single item. An atomic type (simple type excluding lists and unions) indicates a single atomic item. A non-atomic type (complex type, list, or union) indicates a single element (not nillable) of the given type. Note that this simply declares the variable, a value must be bound to the XDynamicContext. See the XDynamicContext.bind() methods. Predefined QNames for built-in types can be found in XTypeConstants.
Parameters:
name - The name of the variable.
type - The type of the variable.
Throws:
java.lang.NullPointerException - if name, or type is null.
java.lang.IllegalArgumentException - if the type is undefined.
See Also:

declareVariable

  1. void declareVariable(javax.xml.namespace.QName name,
  2. XSequenceType type)
Add a variable binding to the static context. Note that this simply declares the variable, a value must be bound to the XDynamicContext. See the XDynamicContext.bind() methods. The XSequenceTypeFactory can be used to create sequence types.
Parameters:
name - The name of the variable.
type - The sequence of the variable.
Throws:
java.lang.NullPointerException - if name, or type is null.
See Also:

getVariableType

  1. XSequenceType getVariableType(javax.xml.namespace.QName name)
Get the type of a variable binding.
Parameters:
name - The name of the variable.
Returns:
The type of the variable
Throws:
java.lang.NullPointerException - if name is null.

setFeature

  1. void setFeature(java.lang.String name,
  2. boolean value)

Set a feature for this static context.

Feature names should be fully qualified java.net.URIs. Implementations may define their own features.

Note: there are no currently defined features, this is for future use.

Parameters:
name - Feature name.
value - Is feature state true or false.
Throws:
java.lang.NullPointerException - if name is null.

getFeature

  1. boolean getFeature(java.lang.String name)

Get the state of the named feature.

Feature names should be fully qualified java.net.URIs. Implementations may define their own features. Info keys and feature keys must be unique from each other, so that the same table can be used for both.

Note: there are no currently defined features, this is for future use.

Parameters:
name - Feature name.
Returns:
State of the named feature.
Throws:
java.lang.NullPointerException - if name is null.

setMessageHandler

  1. void setMessageHandler(XMessageHandler handler)
Set a message handler to process static errors and messages.
Parameters:
handler - The error handler.
Throws:
java.lang.NullPointerException - if handler is null.
See Also:

getMessageHandler

  1. XMessageHandler getMessageHandler( )
Get the static message handler.
Returns:
The message handler or null if no message handler has been registered.

getIntegerMathMode

  1. int getIntegerMathMode()
Get the integer math mode, which is a constant representing the level of precision required and whether overflow detection is required when working with xs:integer values.
Returns:
The integer math mode value, one of: INTEGER_MATH_MODE_LIMITED_PRECISION, INTEGER_MATH_MODE_ARBITRARY_PRECISION, INTEGER_MATH_MODE_OVERFLOW_DETECTION.

setIntegerMathMode

  1. void setIntegerMathMode(int mode)
Set the integer math mode, which is a constant representing the level of precision required and whether overflow detection is required when working with xs:integer values. The default is INTEGER_MATH_MODE_LIMITED_PRECISION.
Parameters:
mode - The integer math mode value, one of: INTEGER_MATH_MODE_LIMITED_PRECISION, INTEGER_MATH_MODE_ARBITRARY_PRECISION, INTEGER_MATH_MODE_OVERFLOW_DETECTION.
Throws:
java.lang.IllegalArgumentException - if mode is not one of: INTEGER_MATH_MODE_LIMITED_PRECISION, INTEGER_MATH_MODE_ARBITRARY_PRECISION, INTEGER_MATH_MODE_OVERFLOW_DETECTION.

setUseCompiler

  1. void setUseCompiler(boolean value)
Set whether to use the compiler when preparing an expression (as opposed to the interpreter). Note that this only applies to the XFactory prepare methods. The XCompilationFactory compile methods always use the compiler.
Parameters:
value - Pass in true to use the compiler, false to use the interpreter. The default is to use the interpreter.

getUseCompiler

  1. boolean getUseCompiler()
Get the use compiler setting.
Returns:
The use compiler setting as a boolean.

getModuleResolver

  1. XModuleResolver getModuleResolver( )
Get the registered resolver for XQuery modules.
Returns:
The XModuleResolver if set, otherwise null.

setModuleResolver

  1. void setModuleResolver(XModuleResolver moduleResolver)
Register a resolver for XQuery modules. Pass in null for the moduleResolver to restore the default module resolution behaviour. The default behaviour for resolving modules is to use the base URI of the importing module to resolve the imported module's location. If the base URI is not available, the current working directory will be used. The processor will attempt to locate one module per location hint. If no modules can be located for the target namespace, an error will be raised.
Parameters:
moduleResolver - The module resolver or null.
See Also: