use of org.exist.dom.memtree.NodeImpl in project exist by eXist-db.
the class ArrayListValueSequence method getPreceding.
@Override
public Sequence getPreceding(final NodeTest test, final int position) throws XPathException {
final ArrayListValueSequence nodes = new ArrayListValueSequence();
for (final Item value : values) {
final NodeImpl node = (NodeImpl) value;
node.selectPreceding(test, nodes, position);
}
return nodes;
}
use of org.exist.dom.memtree.NodeImpl in project exist by eXist-db.
the class ArrayListValueSequence method getAncestors.
@Override
public Sequence getAncestors(final boolean includeSelf, final NodeTest test) throws XPathException {
final ArrayListValueSequence nodes = new ArrayListValueSequence();
for (final Item value : values) {
final NodeImpl node = (NodeImpl) value;
node.selectAncestors(includeSelf, test, nodes);
}
return nodes;
}
use of org.exist.dom.memtree.NodeImpl in project exist by eXist-db.
the class Utils method nodeFromString.
public static NodeImpl nodeFromString(XQueryContext context, String source) throws IOException {
SAXAdapter adapter = new SAXAdapter(context);
final XMLReaderPool parserPool = context.getBroker().getBrokerPool().getParserPool();
XMLReader xr = null;
try {
try {
xr = parserPool.borrowXMLReader();
xr.setContentHandler(adapter);
xr.setProperty(Namespaces.SAX_LEXICAL_HANDLER, adapter);
} catch (Exception e) {
throw new IOException(e);
}
try {
InputSource src = new InputSource(new StringReader(source));
xr.parse(src);
return (NodeImpl) adapter.getDocument();
} catch (SAXException e) {
throw new IOException(e);
}
} finally {
if (xr != null) {
parserPool.returnXMLReader(xr);
}
}
}
Aggregations