コード例 #1
0
        /// <summary>
        /// Compile an expression supplied as a <c>String</c>.
        /// </summary>
        /// <example>
        /// <code>
        /// XPathExecutable q = compiler.Compile("distinct-values(//*/node-name()");
        /// </code>
        /// </example>
        /// <param name="source">A string containing the source text of the XPath expression</param>
        /// <returns>An <c>XPathExecutable</c> which represents the compiled XPath expression object.
        /// The <c>XPathExecutable</c> may be run as many times as required, in the same or a different
        /// thread. The <c>XPathExecutable</c> is not affected by any changes made to the <c>XPathCompiler</c>
        /// once it has been compiled.</returns>
        /// <exception cref="StaticError">
        /// Throws a <c>Saxon.Api.StaticError</c> if there is any static error in the XPath expression.
        /// This includes both syntax errors, semantic errors such as references to undeclared functions or
        /// variables, and statically-detected type errors.
        /// </exception>

        public XPathExecutable Compile(String source)
        {
            try {
                JXPathExecutable executable = compiler.compile(source);
                return(new XPathExecutable(executable));
            }
            catch (JSaxonApiException err)
            {
                throw new StaticError(err);
            }
        }
コード例 #2
0
        // internal constructor

        internal XPathExecutable(JXPathExecutable executable)
        {
            this.executable = executable;
        }