zorba::StaticContext

#include <zorba/static_context.h>

Inherited from: zorba::SmartObject

Instances of the class StaticContext contain the information that is available at the time the query is compiled and run. This class contains the information that is defined in the XQuery specification (see http://www.w3.org/TR/xquery/#static_context).A StaticContext can be created by calling Zorba::createStaticContext and then be passed to the Zorba::compileQuery or XQuery::compile functions. If no static context has been passed to any of these functions, a default static context is used. It can be accessed by calling XQuery::getStaticContext on a compiled XQuery object.Note: This class is reference counted. When writing multi-threaded clients, it is the responibility of the client code to synchronize assignments to the SmartPtr holding this object.

Public Functions

void

addCollation(const String &aURI)=0

Adds a collation URI.

bool

addNamespace(const String &aPrefix, const String &aURI)=0

Add a pair (prefix, URI) to the statically known namespaces that are available during query compilation.

void

addReference() const

void

clearBaseURI()=0

Clears the base URI and sets it to undefined state.

bool

containsFunction(const String &aFnNameUri, const String &aFnNameLocal, int arity) const =0

Check if a function with the given name and arity are registered in the context.

StaticContext_t

createChildContext() const =0

Create a child static context, i.e.

void

declareOption(const Item &aQName, const String &aOptionValue)=0

Declare an option (same as using declare option in XQuery)

void

disableFunction(const Function_t &aFunction)=0

void

disableFunction(const Item &aQName, int arity)=0

Item

fetch(const String &aURI) const =0

Fetches an resource refered to by the given URI.

Item

fetch(const String &aURI, const String &aEntityKind) const =0

Fetches an resource refered to by the given URI.

Item

fetch(const String &aURI, const String &aEntityKind, const String &aEncoding) const =0

Fetches an resource refered to by the given URI.

Item

fetchBinary(const String &aURI) const =0

Fetches an resource refered to by the given URI and returns it as a base64binary.

Item

fetchBinary(const String &aURI, const String &aEntityKind) const =0

Fetches an resource refered to by the given URI and returns it as a base64binary.

void

findFunctions(const Item &aQName, std::vector< Function_t > &aFunctions) const =0

void

free()

audit::Event *

getAuditEvent() const =0

gets the audit event that is populated during execution

String

getBaseURI() const =0

Get the base URI.

boundary_space_mode_t

getBoundarySpacePolicy() const =0

Get the boundary space policy.

SequenceType

getCollectionType(const String &aCollectionUri) const =0

Get the type of a statically known collection.

construction_mode_t

getConstructionMode() const =0

Get the construction mode.

SequenceType

getContextItemStaticType() const =0

Fetch the type of the context item.

void

getCopyNamespacesMode(preserve_mode_t &aPreserve, inherit_mode_t &aInherit) const =0

Get the copy namespace mode.

String

getDefaultCollation() const =0

Get the URI of the default collation.

String

getDefaultElementAndTypeNamespace() const =0

Get the default element and type namespace URI.

String

getDefaultFunctionNamespace() const =0

Get the default function namespace.

order_empty_mode_t

getDefaultOrderForEmptySequences() const =0

Get the default order for the empty sequence.

SequenceType

getDocumentType(const String &aDocUri) const =0

Get the type of a statically known document.

void

getExternalVariables(Iterator_t &aVarsIter) const =0

Returns the QName of all external variables within the static context.

void

getFullLibPath(std::vector< String > &aLibPath) const =0

Return the URI lookup path (list of filesystem directories) for this static context and all its parents.

void

getFullModulePaths(std::vector< String > &aFullModulePaths) const =0

Return the union of the URI and library lookup paths (lists of filesystem directories) for this static context and all its parents.

void

getFullURIPath(std::vector< String > &aURIPath) const =0

Return the URI lookup path (list of filesystem directories) for this static context and all its parents.

void

getFunctionAnnotations(const Item &aQName, int arity, std::vector< Annotation_t > &aAnnotations) const =0

void

getFunctions(std::vector< Function_t > &aFunctions) const =0

Get all functions declared in the given static context.

void

getFunctions(const String &aFnNameUri, uint32_t arity, std::vector< Function_t > &aFunctions) const =0

Get all functions with a specified namespace and airty\ declared in the given static context.

jsoniq_version_t

getJSONiqVersion() const =0

Get the JSONiq processing mode.

void

getLibPath(std::vector< String > &aLibPath) const =0

Return the URI lookup path (list of filesystem directories) for this static context.

void

getModulePaths(std::vector< String > &aModulePaths) const =0

Return the union of the URI and library lookup paths (lists of filesystem directories) for this static context.

void

getNamespaceBindings(NsBindings &aBindings) const =0

Get the list of all namespace bindings (prefix, uri) declared in this and its parent static contexts.

String

getNamespaceURIByPrefix(const String &aPrefix) const =0

Get the namespace URI for a given prefix.

bool

getOption(const Item &aQName, String &aOptionValue) const =0

Get an option that was declared using the declare option syntax.

ordering_mode_t

getOrderingMode() const =0

Get the ordering mode.

long

getRefCount() const

validation_mode_t

getRevalidationMode() const =0

Get the revalidation mode.

StaticCollectionManager *

getStaticCollectionManager() const =0

Returns a CollectionManager responsible for all collections which are statically declared in this static context.

void

getURIPath(std::vector< String > &aURIPath) const =0

Return the URI lookup path (list of filesystem directories) for this static context.

xpath1_0compatib_mode_t

getXPath1_0CompatibMode() const =0

Get the XPath 1.0 compatibility mode.

xquery_version_t

getXQueryVersion() const =0

Get the XQuery processing mode (version 1.0 or 3.0).

ItemSequence_t

invoke(const Item &aQName, const std::vector< ItemSequence_t > &aArgs) const =0

Invokes the XQuery function with the given name and the given parameters.

void

loadProlog(const String &, const Zorba_CompilerHints_t &hints)=0

Loads the declarations and definitions of a given XQuery prolog into this static context.

bool

registerModule(ExternalModule *aModule)=0

Register a module providing access to external functions.

void

registerURIMapper(URIMapper *aMapper)=0

Register a URI Mapper which will transform a given URI into several alternate potential URIs.

void

registerURLResolver(URLResolver *aResolver)=0

Register a URL Resolver which will transform a given URL into a Resource.

void

removeReference()

void

resetTraceStream()=0

Resets the output stream that is used by the fn:trace function to std::cerr.

String

resolve(const String &aRelativeUri) const =0

Resolves the given URI against the value of the base-uri property from the static context.

String

resolve(const String &aRelativeUri, const String &aBaseUri) const =0

Resolves the given relative URI against the absolute base URI.

void

setAuditEvent(audit::Event *anEvent)=0

sets the audit event that will be populated during execution

bool

setBaseURI(const String &aBaseURI)=0

Set the base URI.

bool

setBoundarySpacePolicy(boundary_space_mode_t aMode)=0

Set the boundary space policy.

void

setCollectionType(const String &aCollectionUri, const SequenceType &type)=0

Set the type of a statically known collection.

bool

setConstructionMode(construction_mode_t aMode)=0

Set the construction mode.

void

setContextItemStaticType(const SequenceType &type)=0

Set the type of the context item.

bool

setCopyNamespacesMode(preserve_mode_t aPreserve, inherit_mode_t aInherit)=0

Set the copy namespace mode.

void

setDefaultCollation(const String &aURI)=0

Set the URI of the default collation.

bool

setDefaultElementAndTypeNamespace(const String &aURI)=0

Set the default element and type namespace (see http://www.w3.org/TR/xquery/#static_context)

bool

setDefaultFunctionNamespace(const String &aURI)=0

Set the default functionnamespace (see http://www.w3.org/TR/xquery/#static_context)

bool

setDefaultFunctionNamespaces(const std::vector< String > &aURIs)=0

Sets a list of default function namespaces that will be used in order during the lookup of functions.

bool

setDefaultOrderForEmptySequences(order_empty_mode_t aMode)=0

Set the default order for the empty sequence.

void

setDocumentType(const String &aDocUri, const SequenceType &type)=0

Set the type of a statically known document.

bool

setJSONiqVersion(jsoniq_version_t aMode)=0

Set the JSONiq processing mode.

void

setLibPath(const std::vector< String > &aLibPath)=0

Set the library lookup path (list of filesystem directories) for this static context.

void

setModulePaths(const std::vector< String > &aModulePaths)=0

Set the URI and library lookup paths (lists of filesystem directories) for this static context.

bool

setOrderingMode(ordering_mode_t aMode)=0

Set the ordering mode.

void

setRevalidationMode(validation_mode_t aMode)=0

Set the revalidation mode.

void

setTraceStream(std::ostream &)=0

Set the output stream that is used by the fn:trace function.

void

setURIPath(const std::vector< String > &aURIPath)=0

Set the URI lookup path (list of filesystem directories) for this static context.

bool

setXPath1_0CompatibMode(xpath1_0compatib_mode_t aMode)=0

Set the XPath 1.0 compatibility mode.

bool

setXQueryVersion(xquery_version_t aMode)=0

Set the XQuery processing mode (version 1.0 or 3.0).

bool

validate(const Item &rootElement, Item &validatedResult, validation_mode_t validationMode=validate_strict) const =0

Validates this Item.

bool

validate(const Item &rootElement, Item &validatedResult, const String &targetNamespace, validation_mode_t validationMode=validate_strict) const =0

Validates this Item while loading the schema for targetNamespace Note: works only on document or element nodes, otherwise returns false.

bool

validateSimpleContent(const String &stringValue, const Item &typeQName, std::vector< Item > &resultList) const =0

Validates stringValue as XML simple content, i.e.

~StaticContext()

Destructor.

Protected Attributes

unsigned int

theRefCount

Public Functions

addCollation

void addCollation(const String &aURI)=0

Adds a collation URI.

The URI specifies the locale and collation strength of the collation that is added. A valid collation URI must begin with http://zorba.io/collations/. This prefix is followed by a collation strength (i.e. PRIMARY, SECONDARY, TERTIARY, QUATTERNARY, or IDENTICAL) followed by a '/'. After the strength a lower-case two- or three-letter ISO-639 language code must follow. The URI may end with an upper-case two-letter ISO-3166. For example, http://zorba.io/collations/PRIMARY/en/US specifies an english language with US begin the country..Internally, ICU is used for comparing strings. For detailed description see http://www.icu-project.org/apiref/icu4c/classCollator.html and http://www.icu-project.org/apiref/icu4c/classLocale.html

Parameters

aURI the URI of the collation.

Parameters

if an error occured (e.g. the URI was not a valid collation URI).

addNamespace

bool addNamespace(const String &aPrefix, const String &aURI)=0

Add a pair (prefix, URI) to the statically known namespaces that are available during query compilation.

See http://www.w3.org/TR/xquery/#static_context.

Parameters

aPrefix the prefix String.
aURI the URI String.

Returns

true if the pair was added to the set of statically known namespaces, false otherwise.

Parameters

if an error occures.

addReference

void addReference() const

clearBaseURI

void clearBaseURI()=0

Clears the base URI and sets it to undefined state.

(see http://www.w3.org/TR/xquery/#static_context)

containsFunction

bool containsFunction(const String &aFnNameUri, const String &aFnNameLocal, int arity) const =0

Check if a function with the given name and arity are registered in the context.

createChildContext

StaticContext_t createChildContext() const =0

Create a child static context, i.e.

a context with the same information, of the given static context.A child static context carries the same context as it's parent but can override any information.

declareOption

void declareOption(const Item &aQName, const String &aOptionValue)=0

Declare an option (same as using declare option in XQuery)

Parameters

aQName The QName of the option to declare.
aOptionValue The value of the option to declare.

disableFunction

void disableFunction(const Function_t &aFunction)=0

disableFunction

void disableFunction(const Item &aQName, int arity)=0

fetch

Item fetch(const String &aURI) const =0

Fetches an resource refered to by the given URI.

Resolution is done using the URI mappers and resolvers registered in this static context. If no such mappers or resolvers have been registered, the built-in ones are used.The default EntityKind for resources fetched by this function is "SOME_CONTENT". The default encoding that is used to read the resource is "UTF-8".

Parameters

aURI the name of the resource to fetch

Returns

the fetched resource

fetch

Item fetch(const String &aURI, const String &aEntityKind) const =0

Fetches an resource refered to by the given URI.

Resolution is done using the URI mappers and resolvers registered in this static context. If no such mappers or resolvers have been registered, the built-in ones are used.The default encoding that is used to read the * resource is "UTF-8".

Parameters

aURI the name of the resource to fetch
aEntityKind the kind of the entity to fetch (i.e. SOME_CONTENT, SCHEMA, MODULE, THESAURUS, or STOP_WORDS)

Returns

the fetched resource

fetch

Item fetch(const String &aURI, const String &aEntityKind, const String &aEncoding) const =0

Fetches an resource refered to by the given URI.

Resolution is done using the URI mappers and resolvers registered in this static context. If no such mappers or resolvers have been registered, the built-in ones are used.

Parameters

aURI the name of the resource to fetch
aEncoding the encoding to use when reading the resource.
aEntityKind the kind of the entity to fetch (i.e. SOME_CONTENT, SCHEMA, MODULE, THESAURUS, or STOP_WORDS)

Returns

the fetched resource

fetchBinary

Item fetchBinary(const String &aURI) const =0

Fetches an resource refered to by the given URI and returns it as a base64binary.

Resolution is done using the URI mappers and resolvers registered in this static context. If no such mappers or resolvers have been registered, the built-in ones are used.The default EntityKind for resources fetched by this function is "SOME_CONTENT".

Parameters

aURI the name of the resource to fetch

Returns

the fetched resource

fetchBinary

Item fetchBinary(const String &aURI, const String &aEntityKind) const =0

Fetches an resource refered to by the given URI and returns it as a base64binary.

Resolution is done using the URI mappers and resolvers registered in this static context. If no such mappers or resolvers have been registered, the built-in ones are used.

Parameters

aURI the name of the resource to fetch
aEntityKind the kind of the entity to fetch (i.e. SOME_CONTENT, SCHEMA, MODULE, THESAURUS, or STOP_WORDS)

Returns

the fetched resource

findFunctions

void findFunctions(const Item &aQName, std::vector< Function_t > &aFunctions) const =0

free

void free()

getAuditEvent

audit::Event * getAuditEvent() const =0

gets the audit event that is populated during execution

Returns

the audit event

getBaseURI

String getBaseURI() const =0

Get the base URI.

Returns

String the base URI.

getBoundarySpacePolicy

boundary_space_mode_t getBoundarySpacePolicy() const =0

Get the boundary space policy.

(see http://www.w3.org/TR/xquery/#static_context)

Returns

boundary_space_mode_t the boundary space policy.

getCollectionType

SequenceType getCollectionType(const String &aCollectionUri) const =0

Get the type of a statically known collection.

getConstructionMode

construction_mode_t getConstructionMode() const =0

Get the construction mode.

(see http://www.w3.org/TR/xquery/#static_context)

Returns

construction_mode_t the construction mode.

getContextItemStaticType

SequenceType getContextItemStaticType() const =0

Fetch the type of the context item.

getCopyNamespacesMode

void getCopyNamespacesMode(preserve_mode_t &aPreserve, inherit_mode_t &aInherit) const =0

Get the copy namespace mode.

(see http://www.w3.org/TR/xquery/#static_context)

Returns

aPreserve the preserve mode. aInherit the inherit mode.

getDefaultCollation

String getDefaultCollation() const =0

Get the URI of the default collation.

Returns

String the URI of the default collation.

getDefaultElementAndTypeNamespace

String getDefaultElementAndTypeNamespace() const =0

Get the default element and type namespace URI.

Returns

String the URI for the default element and type namespace.

Parameters

if an error occured.

getDefaultFunctionNamespace

String getDefaultFunctionNamespace() const =0

Get the default function namespace.

Returns

String the URI of the default function namespace. DiagnosticHandler has been registered.

Parameters

if an error occured.

getDefaultOrderForEmptySequences

order_empty_mode_t getDefaultOrderForEmptySequences() const =0

Get the default order for the empty sequence.

(see http://www.w3.org/TR/xquery/#static_context)

Returns

order_empty_mode_t the ordering mode.

getDocumentType

SequenceType getDocumentType(const String &aDocUri) const =0

Get the type of a statically known document.

getExternalVariables

void getExternalVariables(Iterator_t &aVarsIter) const =0

Returns the QName of all external variables within the static context.

Parameters

aVarsIter iterator to store the results.

Parameters

if an error occured.

getFullLibPath

void getFullLibPath(std::vector< String > &aLibPath) const =0

Return the URI lookup path (list of filesystem directories) for this static context and all its parents.

getFullModulePaths

void getFullModulePaths(std::vector< String > &aFullModulePaths) const =0

Return the union of the URI and library lookup paths (lists of filesystem directories) for this static context and all its parents.

DeprecatedUse StaticContext::getFullURIPath() and StaticContext::getFullLibPath().

getFullURIPath

void getFullURIPath(std::vector< String > &aURIPath) const =0

Return the URI lookup path (list of filesystem directories) for this static context and all its parents.

getFunctionAnnotations

void getFunctionAnnotations(const Item &aQName, int arity, std::vector< Annotation_t > &aAnnotations) const =0

getFunctions

void getFunctions(std::vector< Function_t > &aFunctions) const =0

Get all functions declared in the given static context.

Returns

aFunctions all of the said functions

getFunctions

void getFunctions(const String &aFnNameUri, uint32_t arity, std::vector< Function_t > &aFunctions) const =0

Get all functions with a specified namespace and airty\ declared in the given static context.

Parameters

aFnNameUri the namespace for the functions to return
arity the arity for the functions to return
aFunctions all of the said functions

getJSONiqVersion

jsoniq_version_t getJSONiqVersion() const =0

Get the JSONiq processing mode.

Returns

jsoniq_version_t the JSONiq version processing mode.

getLibPath

void getLibPath(std::vector< String > &aLibPath) const =0

Return the URI lookup path (list of filesystem directories) for this static context.

Returns any values set by StaticContext::setLibPath() on this static context. To return the full library lookup path for this static context and all its parents (usually most useful), call StaticContext::getFullLibPath().

getModulePaths

void getModulePaths(std::vector< String > &aModulePaths) const =0

Return the union of the URI and library lookup paths (lists of filesystem directories) for this static context.

DeprecatedUse StaticContext::getURIPath() and StaticContext::getLibPath(). Use StaticContext::getURIPath() and StaticContext::getLibPath().Returns any values set by StaticContext::setLibPath() and/or StaticContext::setURIPath() on this static context.

getNamespaceBindings

void getNamespaceBindings(NsBindings &aBindings) const =0

Get the list of all namespace bindings (prefix, uri) declared in this and its parent static contexts.

Parameters

aBindings the bindings are added to this list

getNamespaceURIByPrefix

String getNamespaceURIByPrefix(const String &aPrefix) const =0

Get the namespace URI for a given prefix.

Parameters

aPrefix the prefix for which to retrieve the namespace URI.

Returns

String the URI for the given prefix or an empty String if no URI could be found for the given prefix and an DiagnosticHandler has been registered.

Parameters

if an error occured (e.g. no URI could be found for the given prefix).
DeprecatedThis function is deprecated. Use getNamespaceBindings instead.

getOption

bool getOption(const Item &aQName, String &aOptionValue) const =0

Get an option that was declared using the declare option syntax.

Parameters

aQName The QName of the option to get.
aOptionValue The value of the option if found.

Returns

true if the option was found, false otherwise.

getOrderingMode

ordering_mode_t getOrderingMode() const =0

Get the ordering mode.

(see http://www.w3.org/TR/xquery/#static_context)

Returns

ordering_mode_t the ordering mode.

getRefCount

long getRefCount() const

getRevalidationMode

validation_mode_t getRevalidationMode() const =0

Get the revalidation mode.

Returns

the revalidation mode.

getStaticCollectionManager

StaticCollectionManager * getStaticCollectionManager() const =0

Returns a CollectionManager responsible for all collections which are statically declared in this static context.

The collection manager provides a set of functions for managing collections and their contents.

Returns

The collection manager responsible for managing collections of this context.

getURIPath

void getURIPath(std::vector< String > &aURIPath) const =0

Return the URI lookup path (list of filesystem directories) for this static context.

Returns any values set by StaticContext::setURIPath() on this static context. To return the full URI lookup path for this static context and all its parents (usually most useful), call StaticContext::getFullURIPath().

getXPath1_0CompatibMode

xpath1_0compatib_mode_t getXPath1_0CompatibMode() const =0

Get the XPath 1.0 compatibility mode.

(see http://www.w3.org/TR/xquery/#static_context)

Returns

xpath1_0compatib_mode_t the XPath 1.0 compatibility mode.

getXQueryVersion

xquery_version_t getXQueryVersion() const =0

Get the XQuery processing mode (version 1.0 or 3.0).

Returns

xquery_version_t the XQuery version processing mode.

invoke

ItemSequence_t invoke(const Item &aQName, const std::vector< ItemSequence_t > &aArgs) const =0

Invokes the XQuery function with the given name and the given parameters.

Note that the function to be invoked needs to be declared in this static context. In order to declare a function in the static context, the loadProlog method of this class can be used.Also note that if the function to be invoked is an updating function, its resulting pending update list is implicitly applied by this function.

Parameters

aQName the name of the function to be invoked
aArgs a vector of ItemSequences. One entry in the vector corresponds to one argument that is passed to the function.

Returns

The result of the function that is invoked. If the function to be invoked is an updating function, the resulting item sequence is empty.

loadProlog

void loadProlog(const String &, const Zorba_CompilerHints_t &hints)=0

Loads the declarations and definitions of a given XQuery prolog into this static context.

This function compiles the prolog passed as first parameter and loads all declarations and definitions into this static context.The static context extended by this prolog can then be used for creating a compiling a new query.A StaticException is raised if the prolog could not be compiled or if the prolog does not contain valid declarations (e.g. duplicate declarations).

registerModule

bool registerModule(ExternalModule *aModule)=0

Register a module providing access to external functions.

Register a module that provides access to external functions. The caller keeps the ownership of the Module and the StatelessExternalFunction objects passed to this function.

Parameters

aModule the module object

Returns

true if the module has been set, false otherwise.

registerURIMapper

void registerURIMapper(URIMapper *aMapper)=0

Register a URI Mapper which will transform a given URI into several alternate potential URIs.

QQQ doc

registerURLResolver

void registerURLResolver(URLResolver *aResolver)=0

Register a URL Resolver which will transform a given URL into a Resource.

QQQ doc

removeReference

void removeReference()

resetTraceStream

void resetTraceStream()=0

Resets the output stream that is used by the fn:trace function to std::cerr.

resolve

String resolve(const String &aRelativeUri) const =0

Resolves the given URI against the value of the base-uri property from the static context.

Parameters

aRelativeUri The relative URI to be resolved.

resolve

String resolve(const String &aRelativeUri, const String &aBaseUri) const =0

Resolves the given relative URI against the absolute base URI.

Parameters

aRelativeUri The relative URI to be resolved.
aBaseUri The absolute URI against which the resolving is performed.

setAuditEvent

void setAuditEvent(audit::Event *anEvent)=0

sets the audit event that will be populated during execution

Parameters

anEvent the audit event

setBaseURI

bool setBaseURI(const String &aBaseURI)=0

Set the base URI.

(see http://www.w3.org/TR/xquery/#static_context)

Parameters

aBaseURI the base URI as String.

Returns

true if the base URI has been set, false otherwise.

setBoundarySpacePolicy

bool setBoundarySpacePolicy(boundary_space_mode_t aMode)=0

Set the boundary space policy.

(see http://www.w3.org/TR/xquery/#static_context)

Parameters

aMode the boundary space policy.

Returns

true if the mode was set, false otherwise.

setCollectionType

void setCollectionType(const String &aCollectionUri, const SequenceType &type)=0

Set the type of a statically known collection.

setConstructionMode

bool setConstructionMode(construction_mode_t aMode)=0

Set the construction mode.

(see http://www.w3.org/TR/xquery/#static_context)

Parameters

aMode the construction mode.

Returns

true if the mode was set, false otherwise.

setContextItemStaticType

void setContextItemStaticType(const SequenceType &type)=0

Set the type of the context item.

setCopyNamespacesMode

bool setCopyNamespacesMode(preserve_mode_t aPreserve, inherit_mode_t aInherit)=0

Set the copy namespace mode.

(see http://www.w3.org/TR/xquery/#static_context)

Parameters

aPreserve the preserve mode.
aInherit the inherit mode.

Returns

true if the mode was set, false otherwise.

setDefaultCollation

void setDefaultCollation(const String &aURI)=0

Set the URI of the default collation.

(see http://www.w3.org/TR/xquery/#static_context)

Parameters

aURI URI of the default collation.

Parameters

if an error occured (e.g., the URI does not identify a collation among the statically known collations.

setDefaultElementAndTypeNamespace

bool setDefaultElementAndTypeNamespace(const String &aURI)=0

Set the default element and type namespace (see http://www.w3.org/TR/xquery/#static_context)

Parameters

aURI of the default element and type namespace URI.

Returns

true if the default element and type namespace URI has been set, false otherwise if an DiagnosticHandler has been registered.

Parameters

if an error occured.

setDefaultFunctionNamespace

bool setDefaultFunctionNamespace(const String &aURI)=0

Set the default functionnamespace (see http://www.w3.org/TR/xquery/#static_context)

Parameters

aURI of the default function namespace.

Returns

true if the default function namespace URI has been set, false otherwise if an DiagnosticHandler has been registered.

Parameters

if an error occured.

setDefaultFunctionNamespaces

bool setDefaultFunctionNamespaces(const std::vector< String > &aURIs)=0

Sets a list of default function namespaces that will be used in order during the lookup of functions.

Parameters

aURIs the list of default function namespaces.

Returns

true if the said namespaces have been set, false otherwise if an DiagnosticHandler has been registered.

Parameters

if an error occured.

setDefaultOrderForEmptySequences

bool setDefaultOrderForEmptySequences(order_empty_mode_t aMode)=0

Set the default order for the empty sequence.

(see http://www.w3.org/TR/xquery/#static_context)

Parameters

aMode the default order for the empty sequence.

Returns

true if the mode was set, false otherwise.

setDocumentType

void setDocumentType(const String &aDocUri, const SequenceType &type)=0

Set the type of a statically known document.

setJSONiqVersion

bool setJSONiqVersion(jsoniq_version_t aMode)=0

Set the JSONiq processing mode.

Parameters

aMode the JSONiq version

Returns

true if the version was set, false otherwise.

setLibPath

void setLibPath(const std::vector< String > &aLibPath)=0

Set the library lookup path (list of filesystem directories) for this static context.

Queries which import modules that have external function implementations will look for the implementation of those functions (shared libraries) in these directories.

setModulePaths

void setModulePaths(const std::vector< String > &aModulePaths)=0

Set the URI and library lookup paths (lists of filesystem directories) for this static context.

Note that calling this method will override any values previously passed to StaticContext::setURIPath() and StaticContext::setLibPath(). DeprecatedUse StaticContext::setURIPath() and StaticContext::setLibPath().Convenience method which adds the listed directories to both the URI path and Library path for this static context.

setOrderingMode

bool setOrderingMode(ordering_mode_t aMode)=0

Set the ordering mode.

(see http://www.w3.org/TR/xquery/#static_context)

Parameters

aMode the ordering mode.

Returns

true if the mode was set, false otherwise.

setRevalidationMode

void setRevalidationMode(validation_mode_t aMode)=0

Set the revalidation mode.

Parameters

aMode the revalidation mode.

setTraceStream

void setTraceStream(std::ostream &)=0

Set the output stream that is used by the fn:trace function.

Sets the output stream that is used by the fn:trace function to the given output stream. The default stream is std::cerr.

setURIPath

void setURIPath(const std::vector< String > &aURIPath)=0

Set the URI lookup path (list of filesystem directories) for this static context.

Queries which resolve URIs (for instance, importing modules or schemas) will look in these directories.

setXPath1_0CompatibMode

bool setXPath1_0CompatibMode(xpath1_0compatib_mode_t aMode)=0

Set the XPath 1.0 compatibility mode.

(see http://www.w3.org/TR/xquery/#static_context)

Parameters

aMode the XPath 1.0 compatibility mode.

Returns

true if the mode was set, false otherwise.

setXQueryVersion

bool setXQueryVersion(xquery_version_t aMode)=0

Set the XQuery processing mode (version 1.0 or 3.0).

Parameters

aMode the XQuery version.

Returns

true if the version was set, false otherwise.

validate

bool validate(const Item &rootElement, Item &validatedResult, validation_mode_t validationMode=validate_strict) const =0

Validates this Item.

Note: works only on document and element nodes, otherwise returns false.

Parameters

rootElement the root of the tree beeing validated
validatedResult the result of the validation
validationMode Validation mode: default value is validate_strict

Returns

true if validation is correct, false if validation is disabled, throws errors if validation fails

Parameters

if any validation error occured

validate

bool validate(const Item &rootElement, Item &validatedResult, const String &targetNamespace, validation_mode_t validationMode=validate_strict) const =0

Validates this Item while loading the schema for targetNamespace Note: works only on document or element nodes, otherwise returns false.

Parameters

rootElement the root of the tree beeing validated
validatedResult the result of the validation
targetNamespace the expected namespace of root of the tree beeing validated ???
validationMode Validation mode: default value is validate_strict

Returns

true if validation is correct, false if validation is disabled, throws errors if validation fails

Parameters

if any validation error occured

validateSimpleContent

bool validateSimpleContent(const String &stringValue, const Item &typeQName, std::vector< Item > &resultList) const =0

Validates stringValue as XML simple content, i.e.

the text value of attributes or text only element content.

Parameters

stringValue the value to be validated
typeQName
resultList the result of the validation, a vector of atomic Items

Returns

true if validation is correct, false if validation is disabled, throws errors if validation fails

Parameters

if any validation error occured

~StaticContext

 ~StaticContext()

Destructor.

Protected Attributes

theRefCount

unsigned int theRefCount