Example #1
0
        /// <summary>
        /// Compile a query supplied as a <c>String</c>.
        /// </summary>
        /// <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.
        /// </remarks>
        /// <example>
        /// <code>
        /// XQueryExecutable q = compiler.Compile("distinct-values(//*/node-name()");
        /// </code>
        /// </example>
        /// <param name="query">A string containing the source text of the query</param>
        /// <returns>An <c>XQueryExecutable</c> which represents the compiled query object.
        /// The <c>XQueryExecutable</c> may be run as many times as required, in the same or a different
        /// thread. The <c>XQueryExecutable</c> is not affected by any changes made to the <c>XQueryCompiler</c>
        /// once it has been compiled.</returns>
        /// <exception cref="StaticError">Throws a <c>StaticError</c> if errors were detected
        /// during static analysis of the query. Details of the errors will be added as <c>StaticError</c>
        /// objects to the <c>ErrorList</c> if supplied; otherwise they will be written to the standard
        /// error stream. The exception that is returned is merely a summary indicating the
        /// status.</exception>

        public XQueryExecutable Compile(String query)
        {
            try
            {
                JXQueryExecutable exec = compiler.compile(query);
                return(new XQueryExecutable(exec));
            }
            catch (JSaxonApiException e)
            {
                throw new StaticError(e);
            }
        }
Example #2
0
        // internal constructor

        internal XQueryExecutable(JXQueryExecutable exec)
        {
            this.executable = exec;
        }