Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > XML applications > Use the XML API to perform operations > Performing basic operations


Use static and dynamic contexts

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

Static context

The static context is used to configure prepare-time characteristics.

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. 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.
Performing basic XPath operations
Performing basic XQuery operations
Performing basic XSLT operations

+

Search Tips   |   Advanced Search