jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phillip Rhodes <spamsu...@rhoderunner.com>
Subject // in xpath does not match immediate children
Date Tue, 01 May 2007 19:34:06 GMT
Hello everyone,

I am using jackrabbit to store "tags" that a user creates. 
Given a structure (below) where each leaf node has an attribute of CONTENT_TYPE with a value
of "Tag"
/myfolder/tag 1/Tag 1
/myfolder/tag 2/Tag 2
/myfolder/tag 3/Tag 3

My application needs to be able to query for what tags exist under a node path 
what tags are under /myfolder/tag 1?
what tags are usder /myfolder/?

My problem is that my xpath expression is not working for queries that pass the tag parent
in as a node to look down.
I have a tag with a node path of /myfolder/tag 1/Tag 1 , but xpath search for tags in /myfolder/tag
1 fails to find any nodes.

This query will not find it:
/jcr:root/myfolder/tag 1//*[@CONTENT_TYPE = 'Tag']

This query does find it (but it is not restrictive enough, returns nodes in all folders).
/jcr:root/myfolder//*[@CONTENT_TYPE = 'Tag']
/myfolder/tag 1/Tag 1
/myfolder/tag 2/Tag 2
/myfolder/tag 3/Tag 3
/myfolder/tag 4/Tag 4

Is there a way to do a search in xpath that does children AND it's descendents?


View raw message