示例#1
0
文件: XPath.cs 项目: fidothe/saxon-he
        /// <summary>
        /// Evaluate the expression, returning the result as an <c>XdmValue</c> (that is,
        /// a sequence of nodes and/or atomic values).
        /// </summary>
        /// <remarks>
        /// Although a singleton result <i>may</i> be represented as an <c>XdmItem</c>, there is
        /// no guarantee that this will always be the case. If you know that the expression will return at
        /// most one node or atomic value, it is best to use the <c>EvaluateSingle</c> method, which
        /// does guarantee that an <c>XdmItem</c> (or null) will be returned.
        /// </remarks>
        /// <returns>
        /// An <c>XdmValue</c> representing the results of the expression.
        /// </returns>

        public XdmValue Evaluate()
        {
            JXPathContextMajor context = new JXPathContextMajor(contextItem, config);

            context.setStackFrame(env.getStackFrameMap(), variableValues);
            JValueRepresentation value = JSequenceExtent.makeSequenceExtent(exp.iterate(context));

            return(XdmValue.Wrap(value));
        }
示例#2
0
文件: XPath.cs 项目: fidothe/saxon-he
        // internal constructor

        internal XPathSelector(JXPathExpression exp, JConfiguration config, DotNetIndependentContext env)
        {
            this.exp       = exp.getInternalExpression();
            this.config    = config;
            this.env       = env;
            variableValues = new JValueRepresentation[env.getStackFrameMap().getNumberOfVariables()];
            // TODO: there are some reuse issues here if the compiler/static context has been reused
        }
        // internal constructor

        internal XPathSelector(JXPathExpression exp, JConfiguration config, DotNetIndependentContext env) {
            this.exp = exp.getInternalExpression();
            this.config = config;
            this.env = env;
            variableValues = new JValueRepresentation[env.getStackFrameMap().getNumberOfVariables()];
            // TODO: there are some reuse issues here if the compiler/static context has been reused
        }