jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: Query using Path Constraints and Same Name Siblings (SNS)
Date Tue, 23 Feb 2010 16:14:20 GMT
On Tue, Feb 23, 2010 at 16:58, Gadbury <gadbury@googlemail.com> wrote:
> I have found out (to my horror!) after debugging that the following queries
> are not the same :)
> /jcr:root/shop/providers/provider/element(*, jpg:account)
> /jcr:root/shop/providers/provider[1]/element(*, jpg:account)
> The second query is the correct one in this case as I wish to return all
> nodes of type jpg:account that are under the first provider (provider[1]).
> Is there a way to stop getPath() from omitting the index notation for the
> first same name sibling?

If you need to separate between an SNS node and a normal one, you can
check via Node.getIndex(). This will return 1 for not-SNS nodes, so
you can check for actual existing SNS via
parentNode.getNodes(namePattern). Then you can build the path with the
index manually.

> Are SNS really that 'dangerous'?

Yes ;-)


Alexander Klimetschek

View raw message