Package org.exist.xquery

Examples of org.exist.xquery.NodeSelector


    private static Sequence seqSpeech = null;
    private static DocumentSet docs = null;
   
    @Test
    public void childSelector() throws XPathException {
        NodeSelector selector = new ChildSelector(seqSpeech.toNodeSet(), -1);
        NameTest test = new NameTest(Type.ELEMENT, new QName("LINE", ""));
        NodeSet set = broker.getStructuralIndex().findElementsByTagName(ElementValue.ELEMENT, seqSpeech.getDocumentSet(), test.getName(), selector);
       
        assertEquals(9492, set.getLength());
    }
View Full Code Here


        assertEquals(9492, set.getLength());
    }
   
    @Test
    public void descendantOrSelfSelector() throws XPathException {
        NodeSelector selector = new DescendantOrSelfSelector(seqSpeech.toNodeSet(), -1);
        NameTest test = new NameTest(Type.ELEMENT, new QName("SPEECH", ""));
        NodeSet set = broker.getStructuralIndex().findElementsByTagName(ElementValue.ELEMENT, seqSpeech.getDocumentSet(), test.getName(), selector);
       
        assertEquals(2628, set.getLength());
    }
View Full Code Here

        assertEquals(2628, set.getLength());
    }
   
    @Test
    public void ancestorSelector() throws XPathException {
        NodeSelector selector = new AncestorSelector(seqSpeech.toNodeSet(), -1, false, true);
        NameTest test = new NameTest(Type.ELEMENT, new QName("ACT", ""));
        NodeSet set = broker.getStructuralIndex().findElementsByTagName(ElementValue.ELEMENT, seqSpeech.getDocumentSet(),  test.getName(), selector);
       
        assertEquals(15, set.getLength());
    }
View Full Code Here

    }
   
    @Test
    public void ancestorSelector_self() throws XPathException {
        NodeSet ns = seqSpeech.toNodeSet();
        NodeSelector selector = new AncestorSelector(ns, -1, true, true);
        NameTest test = new NameTest(Type.ELEMENT, new QName("SPEECH", ""));
        NodeSet set = broker.getStructuralIndex().findElementsByTagName(ElementValue.ELEMENT, seqSpeech.getDocumentSet(), test.getName(), selector);
       
        assertEquals(2628, set.getLength());
    }
View Full Code Here

    @Test
    public void descendantSelector() throws XPathException, SAXException, PermissionDeniedException {
        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());
    }
View Full Code Here

        try {
            broker = pool.get(null);
            final MutableDocumentSet docs = new DefaultDocumentSet();
            docs.add(this);
            final NodeProxy p = new NodeProxy(this, root.getNodeId(), root.getInternalAddress());
            final NodeSelector selector = new DescendantSelector(p, Expression.NO_CONTEXT_ID);
            return broker.getStructuralIndex().findElementsByTagName(ElementValue.ELEMENT, docs, qname, selector, null);
        } catch (final Exception e) {
            LOG.warn("Exception while finding elements: " + e.getMessage(), e);
        } finally {
            pool.release(broker);
View Full Code Here

TOP

Related Classes of org.exist.xquery.NodeSelector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.