jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alvaro Gonzalez <agonza...@germinus.com>
Subject Descendant-or-self
Date Mon, 13 Mar 2006 12:08:04 GMT
Hi list,

I have been doing some tests with "//" (descendant-or-self) axis, and i 
think is not interpreted correctly by Jacrabbit Query Builder.
A query with this axis returns only "descendant" nodes instead of 
"descendant-or-self" nodes. For example with this piece of code:

        Node myTopNode = 
rootNode.addNode("myTopNode");                      
        myTopNode.addNode("subNode");       
        myTopNode.addNode("subNode");       
        rootNode.save();
        String query = "//myTopNode//*";
        //Should find all the 3 nodes: myTopNode and 2 subnodes.
        QueryManager qm = currentSession.getWorkspace().getQueryManager();
        Query q = qm.createQuery(query, Query.XPATH);
        QueryResult qr =  q.execute();                      
        NodeIterator nodes = qr.getNodes();
        assertEquals(3, nodes.getSize());

the test fails because it only finds two nodes instead of three. Is this 
a bug? Am I misunderstanding "//" axis?

Regards,

  Alvaro

-- 
Alvaro Gonzalez de Paz
Germinus XXI
http://www.germinus.com

Avda. de Manoteras, 44. 2ยช planta.
28050 - Madrid (Spain)
Tel (+34) 91 296 12 34
Fax (+34) 91 296 12 30


Mime
View raw message