public static XdmSequenceIterator<XdmNode> ofNodes(AxisIterator base) { return new XdmSequenceIterator<>(base); }
public static XdmSequenceIterator<XdmAtomicValue> ofAtomicValues(UnfailingIterator<? extends AtomicValue> base) { return new XdmSequenceIterator<>(base); }
public static XdmSequenceIterator<XdmNode> ofNodes(AxisIterator base) { return new XdmSequenceIterator<>(base); }
public static XdmSequenceIterator<XdmAtomicValue> ofAtomicValues(UnfailingIterator<? extends AtomicValue> base) { return new XdmSequenceIterator<>(base); }
/** * Get an iterator over the results of the query * @throws SaxonApiUncheckedException if a dynamic error is detected while constructing the iterator. * It is also possible for an SaxonApiUncheckedException to be thrown by the hasNext() method of the * returned iterator if a dynamic error occurs while evaluating the result sequence. */ public Iterator<XdmItem> iterator() throws SaxonApiUncheckedException { try { return new XdmSequenceIterator(expression.iterator(context)); } catch (XPathException e) { throw new SaxonApiUncheckedException(e); } }
protected static XdmSequenceIterator<XdmNode> ofNode(XdmNode node) { return new XdmSequenceIterator<>(SingletonIterator.makeIterator(node.getUnderlyingNode())); }
protected static XdmSequenceIterator<XdmNode> ofNode(XdmNode node) { return new XdmSequenceIterator<>(SingletonIterator.makeIterator(node.getUnderlyingNode())); }
/** * Returns an iterator over the items in this value. * @return an Iterator over the items in this value. * @throws SaxonApiUncheckedException if the value is lazily evaluated and the delayed * evaluation fails with a dynamic error. */ public XdmSequenceIterator iterator() throws SaxonApiUncheckedException { try { ValueRepresentation v = getUnderlyingValue(); if (v instanceof Value) { return new XdmSequenceIterator(((Value)v).iterate()); } else { return new XdmSequenceIterator(SingletonIterator.makeIterator((NodeInfo)v)); } } catch (XPathException e) { throw new SaxonApiUncheckedException(e); } }
/** * Get an iterator over the nodes reachable from this node via a given axis. * * @param axis identifies which axis is to be navigated * @return an iterator over the nodes on the specified axis, starting from this node as the * context node. The nodes are returned in axis order, that is, in document order for a forwards * axis and in reverse document order for a reverse axis. */ public XdmSequenceIterator axisIterator(Axis axis) { AxisIterator base = getUnderlyingNode().iterateAxis(axis.getAxisNumber()); return new XdmSequenceIterator(base); }
/** * Evaluate the expression, returning the result as an <code>Iterator</code> (that is, * an iterator over a sequence of nodes and/or atomic values). * <p>Because an <code>XPathSelector</code> is an {@link Iterable}, it is possible to * iterate over the result using a Java 5 "for each" expression, for example:</p> * <pre> * XPathCompiler compiler = processor.newXPathCompiler(); * XPathSelector seq = compiler.compile("1 to 20").load(); * for (XdmItem item : seq) { * System.err.println(item); * } * </pre> * * @return An iterator over the sequence that represents the results of the expression. * Each object in this sequence will be an instance of <code>XdmItem</code>. 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. * @throws SaxonApiUncheckedException if a dynamic error occurs during XPath evaluation that * can be detected at this point. It is also possible that an SaxonApiUncheckedException will * be thrown by the <code>hasNext()</code> method of the returned iterator. */ public XdmSequenceIterator<XdmItem> iterator() throws SaxonApiUncheckedException { try { return new XdmSequenceIterator<>(exp.iterate(dynamicContext)); } catch (XPathException e) { throw new SaxonApiUncheckedException(e); } }
/** * Get an iterator over the items in this value. * * @return an Iterator over the items in this value. * @throws SaxonApiUncheckedException if the value is lazily evaluated and the delayed * evaluation fails with a dynamic error. */ public Iterator<XdmItem> iterator() throws SaxonApiUncheckedException { try { Sequence<?> v = getUnderlyingValue(); return new XdmSequenceIterator<>(v.iterate()); } catch (XPathException e) { throw new SaxonApiUncheckedException(e); } }
/** * Evaluate the expression, returning the result as an <code>Iterator</code> (that is, * an iterator over a sequence of nodes and/or atomic values). * <p>Because an <code>XPathSelector</code> is an {@link Iterable}, it is possible to * iterate over the result using a Java 5 "for each" expression, for example:</p> * <pre> * XPathCompiler compiler = processor.newXPathCompiler(); * XPathSelector seq = compiler.compile("1 to 20").load(); * for (XdmItem item : seq) { * System.err.println(item); * } * </pre> * * @return An iterator over the sequence that represents the results of the expression. * Each object in this sequence will be an instance of <code>XdmItem</code>. 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. * @throws SaxonApiUncheckedException if a dynamic error occurs during XPath evaluation that * can be detected at this point. It is also possible that an SaxonApiUncheckedException will * be thrown by the <code>hasNext()</code> method of the returned iterator. */ public XdmSequenceIterator<XdmItem> iterator() throws SaxonApiUncheckedException { try { return new XdmSequenceIterator<>(exp.iterate(dynamicContext)); } catch (XPathException e) { throw new SaxonApiUncheckedException(e); } }
return new XdmSequenceIterator(exp.iterate(dynamicContext)); } catch (XPathException e) { throw new SaxonApiUncheckedException(e);
/** * Evaluate the query, and return an iterator over its results. * <p>This method must not be used with an updating query.</p> * * @return an Iterator<XdmItem>. The XdmSequenceIterator class is a standard Java Iterator with an additional close() * method, which should be called to release resources if the client does not intend to read any more items * from the iterator. * * @throws SaxonApiUncheckedException if a dynamic error is detected while constructing the iterator. * It is also possible for an SaxonApiUncheckedException to be thrown by the hasNext() method of the * returned iterator if a dynamic error occurs while evaluating the result sequence. * @throws IllegalStateException if this is an updating query * @since 9.5.1.5. Previously the method returned Iterator<XdmItem>; the signature changed in Saxon 9.5.1.5 for reasons * described in bug 2016. */ public XdmSequenceIterator<XdmItem> iterator() throws SaxonApiUncheckedException { if (expression.isUpdateQuery()) { throw new IllegalStateException("Query is updating"); } try { return new XdmSequenceIterator<>(expression.iterator(context)); } catch (XPathException e) { throw new SaxonApiUncheckedException(e); } }
/** * Get an iterator over the items in this value. * * @return an Iterator over the items in this value. * @throws SaxonApiUncheckedException if the value is lazily evaluated and the delayed * evaluation fails with a dynamic error. */ public Iterator<XdmItem> iterator() throws SaxonApiUncheckedException { try { Sequence<?> v = getUnderlyingValue(); return new XdmSequenceIterator<>(v.iterate()); } catch (XPathException e) { throw new SaxonApiUncheckedException(e); } }
/** * Evaluate the query, and return an iterator over its results. * <p>This method must not be used with an updating query.</p> * * @return an Iterator<XdmItem>. The XdmSequenceIterator class is a standard Java Iterator with an additional close() * method, which should be called to release resources if the client does not intend to read any more items * from the iterator. * * @throws SaxonApiUncheckedException if a dynamic error is detected while constructing the iterator. * It is also possible for an SaxonApiUncheckedException to be thrown by the hasNext() method of the * returned iterator if a dynamic error occurs while evaluating the result sequence. * @throws IllegalStateException if this is an updating query * @since 9.5.1.5. Previously the method returned Iterator<XdmItem>; the signature changed in Saxon 9.5.1.5 for reasons * described in bug 2016. */ public XdmSequenceIterator<XdmItem> iterator() throws SaxonApiUncheckedException { if (expression.isUpdateQuery()) { throw new IllegalStateException("Query is updating"); } try { return new XdmSequenceIterator<>(expression.iterator(context)); } catch (XPathException e) { throw new SaxonApiUncheckedException(e); } }
NameTest test = new NameTest(kind, nameCode, pool); AxisIterator base = getUnderlyingNode().iterateAxis(axis.getAxisNumber(), test); return new XdmSequenceIterator(base);