Using static and dynamic contexts

You can use the two context interfaces that the XML API provides—XStaticContext and XDynamicContext.

About this task

Static context
The static context is used to configure prepare-time characteristics.
Note: Prepare-time refers to the execution of one of the prepare methods on XFactory or the execution of one of the compile methods on XCompilationFactory.

Static context defines items that are needed to prepare executables, items such as the names and types of external variables and functions that will be available at run time as well as compilation modes like backwards compatibility, math mode, and so on. These items do not change across invocations.

Dynamic context
The dynamic context is used to configure execution-time characteristics.

Dynamic context defines items that are unique to each invocation of an executable, items such as the values for external variables, external function implementations, and resolvers to external inputs or results. These items might change across invocations.

Prepare-time characteristics are not set directly on the XFactory instance so that it can be thread safe. The same is true for execution-time characteristics; they are kept in a separate object from the XExecutable instance so that the executable object itself is thread safe.

The prepare and execute steps themselves are separate because preparation takes time and it would be inefficient to prepare for every execution. Having separate steps allows an expression, query, or stylesheet to be prepared once and the resulting executable object then can be used to process any number of input documents.

Procedure

What to do next

The XPath, XQuery, and XSLT specifications also have the concepts of static and dynamic context. For more information, see the following web pages:

The XStaticContext and XDynamicContext interfaces merge settings from all three languages (XPath, XQuery, and XSLT). To find out which settings apply to which language refer to the "Performing Basic Operations" article for that language in the related tasks listed below.

Task topic    

Terms and conditions for information centers | Feedback

Last updated: April 20, 2014 08:46 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-nd-mp&topic=txml_using_contexts
File name: txml_using_contexts.html