xquery.Expression

The xquery.Expression class represents a valid, compiled xquery expression. It can be instantiated with the xquery.Expression.compile() classmethod. The same xquery.Expression can be used for multiple executions with different xquery.RuntimeOptions.

There is also a utility function xquery.compile() that can be used to create an xquery.Expression.

Base class: xquery.xpath.Executable -> xquery.xpath.Module

class xquery.Expression

Class methods

classmethod xquery.Expression.compile(type cls, expression, CompileOptions options)

Compiles a new xquery.Expression object from the provided xquery.ExpressionProvider and xquery.CompileOptions. This involves syntax checking, building of AST, initializing of static context components and static-analysis. In case of a syntax or a static error, the xquery.Expression is None and the xml.ErrorLog contains the error(s).

Returns: (xquery.Expression, xml.ErrorLog)

Attributes

xquery.xpath.Module.location
xquery.xpath.Executable.referenced_modules
xquery.xpath.Module.schema
xquery.xpath.Module.strip_input_type_annotations
xquery.xpath.Module.whitespace_handler

Methods

xquery.Expression.execute(RuntimeOptions options)

Execute the compiled xquery expression with the provided xquery.RuntimeOptions. The main result xpath.Sequence can be accessed via the xpath.ResultList.main_value property. Note that the actual value in the xpath.Sequence will vary depending on the xpath.DeliveryFormat specified in the xquery.RuntimeOptions. In case of a runtime error the returned xpath.ResultList is None and the xml.ErrorLog contains the error.

Returns: (xquery.ResultList, xml.ErrorLog)

xquery.xpath.Module.load_xml_document(unicode uri, f)

Special methods

__eq__, __ge__, __gt__, __le__, __lt__, __ne__