jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: xpath query problem
Date Fri, 16 Jul 2010 11:39:25 GMT
On Fri, Jul 16, 2010 at 12:46, Ahmed Elshereay <AElshereay@idc.com> wrote:
> Can anyone please tell me what is wrong in this statment?
>
>          String statement = "//element(*,
> nt:unstructured)[jcr:like(@jcr:name, 'event%')] order by @jcr:name
> descending";
>
>        Query q =
> session.getWorkspace().getQueryManager().createQuery(statement,
> Query.XPATH);
>        NodeIterator nodes = q.execute().getNodes();
>
> There are a lot of nodes with name starts with 'event', also I tried to
> use [@jcr:name='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() = '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

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message