Saxon API for .NET

XQueryCompiler.Compile Method (String)

Compile a query supplied as a String.

public XQueryExecutable Compile(
   string query
);

Parameters

query
A string containing the source text of the query

Return Value

An XQueryExecutable which represents the compiled query object. The XQueryExecutable may be run as many times as required, in the same or a different thread. The XQueryExecutable is not affected by any changes made to the XQueryCompiler once it has been compiled.

Remarks

Using this method the query processor is provided with a string of Unicode characters, so no decoding is necessary. Any encoding information present in the version declaration is therefore ignored.

Example

            XQueryExecutable q = compiler.Compile("distinct-values(//*/node-name()");
            

See Also

XQueryCompiler Class | Saxon.Api Namespace | XQueryCompiler.Compile Overload List