use of org.exist.xquery.NodeSelector in project exist by eXist-db.
the class BasicNodeSetTest method descendantSelector.
@Test
public void descendantSelector() throws XPathException, SAXException, PermissionDeniedException, EXistException {
try (final DBBroker broker = existEmbeddedServer.getBrokerPool().get(Optional.of(existEmbeddedServer.getBrokerPool().getSecurityManager().getSystemSubject()))) {
Sequence seq = executeQuery(broker, "//SCENE", 72, null);
NameTest test = new NameTest(Type.ELEMENT, new QName("SPEAKER", ""));
NodeSelector selector = new DescendantSelector(seq.toNodeSet(), -1);
NodeSet set = broker.getStructuralIndex().findElementsByTagName(ElementValue.ELEMENT, seq.getDocumentSet(), test.getName(), selector);
assertEquals(2639, set.getLength());
}
}
use of org.exist.xquery.NodeSelector in project exist by eXist-db.
the class MoveOverwriteResourceTest method checkIndex.
private void checkIndex(final DBBroker broker, final DocumentSet docs) throws Exception {
final StructuralIndex index = broker.getStructuralIndex();
final NodeSelector selector = NodeProxy::new;
NodeSet nodes;
nodes = index.findElementsByTagName(ELEMENT, docs, new QName("test2"), selector);
assertTrue(nodes.isEmpty());
nodes = index.findElementsByTagName(ELEMENT, docs, new QName("test1"), selector);
assertFalse(nodes.isEmpty());
}
Aggregations