/// <summary> /// Evaluate the expression, returning the result as an <c>IEnumerator</c> (that is, /// an enumerator over a sequence of nodes and/or atomic values). /// </summary> /// <returns> /// An enumerator over the sequence that represents the results of the expression. /// Each object in this sequence will be an instance of <c>XdmItem</c>. Note /// that the expression may be evaluated lazily, which means that a successful response /// from this method does not imply that the expression has executed successfully: failures /// may be reported later while retrieving items from the iterator. /// </returns> public IEnumerator GetEnumerator() { JXPathContextMajor context = new JXPathContextMajor(contextItem, config); context.setStackFrame(env.getStackFrameMap(), variableValues); return(new SequenceEnumerator(exp.iterate(context))); }
/// <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)); }
/// <summary> /// Evaluate the XPath expression, returning the result as an <c>XdmItem</c> (that is, /// a single node or atomic value). /// </summary> /// <returns> /// An <c>XdmItem</c> representing the result of the expression, or null if the expression /// returns an empty sequence. If the expression returns a sequence of more than one item, /// any items after the first are ignored. /// </returns> public XdmItem EvaluateSingle() { JXPathContextMajor context = new JXPathContextMajor(contextItem, config); context.setStackFrame(env.getStackFrameMap(), variableValues); net.sf.saxon.om.Item i = exp.iterate(context).next(); if (i == null) { return(null); } return((XdmItem)XdmValue.Wrap(i)); }
/// <summary> /// Evaluate the expression, returning the result as an <c>IEnumerator</c> (that is, /// an enumerator over a sequence of nodes and/or atomic values). /// </summary> /// <returns> /// An enumerator over the sequence that represents the results of the expression. /// Each object in this sequence will be an instance of <c>XdmItem</c>. Note /// that the expression may be evaluated lazily, which means that a successful response /// from this method does not imply that the expression has executed successfully: failures /// may be reported later while retrieving items from the iterator. /// </returns> public IEnumerator GetEnumerator() { JXPathContextMajor context = new JXPathContextMajor(contextItem, config); context.setStackFrame(env.getStackFrameMap(), variableValues); return new SequenceEnumerator(exp.iterate(context)); }
/// <summary> /// Evaluate the XPath expression, returning the result as an <c>XdmItem</c> (that is, /// a single node or atomic value). /// </summary> /// <returns> /// An <c>XdmItem</c> representing the result of the expression, or null if the expression /// returns an empty sequence. If the expression returns a sequence of more than one item, /// any items after the first are ignored. /// </returns> public XdmItem EvaluateSingle() { JXPathContextMajor context = new JXPathContextMajor(contextItem, config); context.setStackFrame(env.getStackFrameMap(), variableValues); net.sf.saxon.om.Item i = exp.iterate(context).next(); if (i == null) { return null; } return (XdmItem)XdmValue.Wrap(i); }
/// <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); }