Hi,
On 2/2/06, Michael Singer <[EMAIL PROTECTED]> wrote:
> I want to build an xpath query which returns all nodes of a particular
> (well known) type where the property "value" of child node "name" has
> the value "test".
The normal XPath query for this would be something like this:
//element(*,'type')[name/@value='test']
Unfortunately Jackrabbit doesn't support the child node axis in XPath
predicates (see JCR-247), which means that the above query will not
work.
I can't think of a simple workaround to this issue, so my solution
would be to run a query like //[EMAIL PROTECTED]'test'] and post-process the
results with:
while (iterator.hasNext()) {
Node node = (Node) iterator.next();
Node parent = node.getParent();
if (parent.getPrimaryNodeType().isNodeType("type")) {
// process parent node
}
}
Another solution would be to redesign the node type structure to match
the limitations of the Jackrabbit query capabilities.
BR,
Jukka Zitting
--
Yukatan - http://yukatan.fi/ - [EMAIL PROTECTED]
Software craftmanship, JCR consulting, and Java development