Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 24686 invoked from network); 23 Feb 2010 16:14:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Feb 2010 16:14:53 -0000 Received: (qmail 36246 invoked by uid 500); 23 Feb 2010 16:14:52 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 36215 invoked by uid 500); 23 Feb 2010 16:14:52 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 36204 invoked by uid 99); 23 Feb 2010 16:14:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Feb 2010 16:14:52 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of aklimets@day.com designates 207.126.148.87 as permitted sender) Received: from [207.126.148.87] (HELO eu3sys201aog101.obsmtp.com) (207.126.148.87) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 23 Feb 2010 16:14:43 +0000 Received: from source ([209.85.220.224]) by eu3sys201aob101.postini.com ([207.126.154.11]) with SMTP ID DSNKS4P+3cfYY3OrhWLnwH4vJ66GizKho1U/@postini.com; Tue, 23 Feb 2010 16:14:22 UTC Received: by fxm24 with SMTP id 24so4131919fxm.17 for ; Tue, 23 Feb 2010 08:14:21 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.5.211 with SMTP id 19mr5778266faw.63.1266941660945; Tue, 23 Feb 2010 08:14:20 -0800 (PST) In-Reply-To: <1266940682006-1566095.post@n4.nabble.com> References: <1266940682006-1566095.post@n4.nabble.com> Date: Tue, 23 Feb 2010 17:14:20 +0100 Message-ID: Subject: Re: Query using Path Constraints and Same Name Siblings (SNS) From: Alexander Klimetschek To: users@jackrabbit.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org On Tue, Feb 23, 2010 at 16:58, Gadbury 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 ;-) Regards, Alex -- Alexander Klimetschek alexander.klimetschek@day.com