示例#1
0
文件: XPath.cs 项目: orbeon/saxon-he
        //private ArrayList declaredVariables;

        // internal constructor

        internal XPathExecutable(JXPathExpression exp, JConfiguration config,
                                 JIndependentContext env /*, ArrayList declaredVariables*/)
        {
            this.exp    = exp;
            this.config = config;
            this.env    = env;
            //this.declaredVariables = declaredVariables;
        }
示例#2
0
文件: XPath.cs 项目: orbeon/saxon-he
        // internal constructor

        internal XPathSelector(JXPathExpression exp, JConfiguration config,
                               JIndependentContext env, ArrayList declaredVariables)
        {
            this.exp               = exp;
            this.config            = config;
            this.env               = env;
            this.declaredVariables = declaredVariables;
            this.dynamicContext    = exp.createDynamicContext(null);
        }
示例#3
0
文件: XPath.cs 项目: orbeon/saxon-he
        /// <summary>
        /// Compile an expression supplied as a String.
        /// </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 XPathExecutable 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)
        {
            if (cache != null)
            {
                XPathExecutable exec = (XPathExecutable)cache[source];
                if (exec != null)
                {
                    return(exec);
                }
            }
            try
            {
                JIndependentContext ic = env;
                if (ic.isAllowUndeclaredVariables())
                {
                    // self-declaring variables modify the static context. The XPathCompiler must not change state
                    // as the result of compiling an expression, so we need to copy the static context.
                    ic = new JIndependentContext(env);
                    for (JIterator iter = env.iterateExternalVariables(); iter.hasNext();)
                    {
                        JXPathVariable var  = (JXPathVariable)iter.next();
                        JXPathVariable var2 = ic.declareVariable(var.getVariableQName());
                    }
                }
                JXPathEvaluator eval = new JXPathEvaluator(config);
                eval.setStaticContext(ic);
                JXPathExpression cexp = eval.createExpression(source);
                XPathExecutable  exec = new XPathExecutable(cexp, config, ic);
                if (cache != null)
                {
                    cache[source] = exec;
                }
                return(exec);
            }
            catch (net.sf.saxon.trans.XPathException err)
            {
                throw new StaticError(err);
            }
        }
示例#4
0
        /// <summary>
        /// Compile an expression supplied as a String.
        /// </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 XPathExecutable 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>

        public XPathExecutable Compile(String source)
        {
            JIndependentContext ic = env;

            if (ic.isAllowUndeclaredVariables())
            {
                // self-declaring variables modify the static context. The XPathCompiler must not change state
                // as the result of compiling an expression, so we need to copy the static context.
                ic = env.copy();
                for (JIterator iter = env.iterateExternalVariables(); iter.hasNext();)
                {
                    JXPathVariable var  = (JXPathVariable)iter.next();
                    JXPathVariable var2 = ic.declareVariable(var.getVariableQName());
                }
            }
            JXPathEvaluator eval = new JXPathEvaluator(config);

            eval.setStaticContext(ic);
            JXPathExpression cexp = eval.createExpression(source);

            return(new XPathExecutable(cexp, config, ic));
        }
示例#5
0
文件: XPath.cs 项目: orbeon/saxon-he
        // internal constructor: the public interface is a factory method
        // on the Processor object

        internal XPathCompiler(Processor proc)
        {
            this.processor = proc;
            this.config    = proc.Implementation;
            this.env       = new JIndependentContext(config);
        }
示例#6
0
文件: XPath.cs 项目: orbeon/saxon-he
        // internal constructor: the public interface is a factory method
        // on the Processor object

        internal XPathCompiler(JConfiguration config)
        {
            this.config = config;
            this.env    = new JIndependentContext(config);
        }
示例#7
0
文件: XPath.cs 项目: nuxleus/saxonica
        // internal constructor: the public interface is a factory method
        // on the Processor object

        internal XPathCompiler(Processor proc)
        {
            this.processor = proc;
            this.config = proc.config;
            this.env = new JIndependentContext(config);
        }
示例#8
0
文件: XPath.cs 项目: nuxleus/saxonica
        //private ArrayList declaredVariables;

        // internal constructor

        internal XPathExecutable(JXPathExpression exp, JConfiguration config,
            JIndependentContext env /*, ArrayList declaredVariables*/)
        {
            this.exp = exp;
            this.config = config;
            this.env = env;
            //this.declaredVariables = declaredVariables;
        }