/** * Apply this function to the given argument. In other words, return a stream of nodes * selected by this XPath axis, starting at the supplied origin * * @param node the origin node for the navigation * @return the stream of nodes selected by the axis. The nodes are returned in Axis order * (for a reverse axis like preceding-sibling or ancestor, this is the reverse of document * order). If the supplied argument is not a node, return an empty stream. */ @Override public Stream<? extends XdmNode> apply(XdmItem node) { return node instanceof XdmNode ? ((XdmNode)node).axisIterator(axis).stream() : Stream.empty(); } }
/** * Evaluate the expression, returning the result as an <code>Stream</code>. * * @return A stream delivering the results of the expression. * Each object in this stream 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. */ public XdmStream<XdmItem> stream() throws SaxonApiUncheckedException { return iterator().stream(); }
/** * Apply this function to the given argument. In other words, return a stream of nodes * selected by this XPath axis, starting at the supplied origin * * @param node the origin node for the navigation * @return the stream of nodes selected by the axis. The nodes are returned in Axis order * (for a reverse axis like preceding-sibling or ancestor, this is the reverse of document * order). If the supplied argument is not a node, return an empty stream. */ @Override public Stream<? extends XdmNode> apply(XdmItem node) { return node instanceof XdmNode ? ((XdmNode)node).axisIterator(axis).stream() : Stream.empty(); } }
/** * Evaluate the expression, returning the result as an <code>Stream</code>. * * @return A stream delivering the results of the expression. * Each object in this stream 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. */ public XdmStream<XdmItem> stream() throws SaxonApiUncheckedException { return iterator().stream(); }
@Override public Stream<XdmAtomicValue> apply(XdmItem item) { UnfailingIterator<StringValue> iter = new Whitespace.Tokenizer(item.getStringValue()); return XdmSequenceIterator.ofAtomicValues(iter).stream(); } };
@Override public Stream<XdmAtomicValue> apply(XdmItem item) { UnfailingIterator<StringValue> iter = new Whitespace.Tokenizer(item.getStringValue()); return XdmSequenceIterator.ofAtomicValues(iter).stream(); } };
@Override public Stream<? extends XdmItem> apply(XdmItem item) { try { XPathSelector selector = load(); selector.setContextItem(item); XdmSequenceIterator<XdmItem> result = selector.iterator(); return result.stream(); } catch (SaxonApiException e) { throw new SaxonApiUncheckedException(e); } } };
@Override public Stream<? extends XdmItem> apply(XdmItem item) { try { XPathSelector selector = load(); selector.setContextItem(item); XdmSequenceIterator<XdmItem> result = selector.iterator(); return result.stream(); } catch (SaxonApiException e) { throw new SaxonApiUncheckedException(e); } } };