Search in sources :

Example 1 with DescendantSelector

use of org.exist.xquery.DescendantSelector 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());
    }
}
Also used : DBBroker(org.exist.storage.DBBroker) NameTest(org.exist.xquery.NameTest) QName(org.exist.dom.QName) Sequence(org.exist.xquery.value.Sequence) NodeSelector(org.exist.xquery.NodeSelector) DescendantSelector(org.exist.xquery.DescendantSelector) Test(org.junit.Test) NameTest(org.exist.xquery.NameTest)

Aggregations

QName (org.exist.dom.QName)1 DBBroker (org.exist.storage.DBBroker)1 DescendantSelector (org.exist.xquery.DescendantSelector)1 NameTest (org.exist.xquery.NameTest)1 NodeSelector (org.exist.xquery.NodeSelector)1 Sequence (org.exist.xquery.value.Sequence)1 Test (org.junit.Test)1