Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 12868 invoked from network); 16 Jul 2010 11:42:17 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 16 Jul 2010 11:42:17 -0000 Received: (qmail 22835 invoked by uid 500); 16 Jul 2010 11:42:17 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 22577 invoked by uid 500); 16 Jul 2010 11:42:14 -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 22440 invoked by uid 99); 16 Jul 2010 11:42:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Jul 2010 11:42:13 +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.91 as permitted sender) Received: from [207.126.148.91] (HELO eu3sys201amo010.postini.com) (207.126.148.91) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 16 Jul 2010 11:42:06 +0000 Received: from source ([209.85.161.54]) by eu3sys201aob104.postini.com ([207.126.154.11]) with SMTP ID DSNKTEBE7iEzrfbzNYHyZhbjP+9zHv6/EDUj@postini.com; Fri, 16 Jul 2010 11:41:46 UTC Received: by fxm13 with SMTP id 13so1206453fxm.27 for ; Fri, 16 Jul 2010 04:39:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.239.161.15 with SMTP id f15mr59164hbd.6.1279280365176; Fri, 16 Jul 2010 04:39:25 -0700 (PDT) Received: by 10.239.157.148 with HTTP; Fri, 16 Jul 2010 04:39:25 -0700 (PDT) In-Reply-To: References: Date: Fri, 16 Jul 2010 13:39:25 +0200 Message-ID: Subject: Re: xpath query problem From: Alexander Klimetschek To: users@jackrabbit.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Fri, Jul 16, 2010 at 12:46, Ahmed Elshereay wrote: > Can anyone please tell me what is wrong in this statment? > > =A0 =A0 =A0 =A0 =A0String statement =3D "//element(*, > nt:unstructured)[jcr:like(@jcr:name, 'event%')] order by @jcr:name > descending"; > > =A0 =A0 =A0 =A0Query q =3D > session.getWorkspace().getQueryManager().createQuery(statement, > Query.XPATH); > =A0 =A0 =A0 =A0NodeIterator nodes =3D q.execute().getNodes(); > > There are a lot of nodes with name starts with 'event', also I tried to > use [@jcr:name=3D'history'] as I have nodes that have exact name 'history= ', > but always the itereator is empty! There is no "jcr:name" (pseudo)-property. For an exact node name match, you can use fn:name() =3D 'event'. Wild card matches such as jcr:like() are not possible on node names with XPath or SQL from JCR 1.0. You can use JCR-SQL2 in JCR 2.0 for that. See http://jackrabbit.markmail.org/thread/xvoo5afksxtyplhw Regards, Alex --=20 Alexander Klimetschek alexander.klimetschek@day.com