You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Fidel García Quesada <fi...@gmail.com> on 2009/07/16 12:47:30 UTC
searching with xpath
Hi, this is a simple question but i am newbie with jackrabbit and xpath
I have this in my repository:
..../aaa[1]/bbb[1]/tag = "1"
..../aaa[1]/bbb[1]/ccc/text = "text_demo1"
..../aaa[1]/bbb[2]/tag = "2"
..../aaa[1]/bbb[2]/ccc/text = "text_demo2"
..../aaa[2]/bbb[1]/tag = "1"
..../aaa[2]/bbb[1]/ccc/text = "text_demo3"
..../aaa[2]/bbb[2]/tag = "2"
..../aaa[2]/bbb[2]/ccc/text = "text_demo1"
i want select aaa who contains ((bbb with tag=1) AND (bbb(the same) who
contains ccc with text_demo1)), that's aaa[1]
I tried :
/jcr:root//element(*, aaa) [@bbb/tag='1' and jcr:contains(@bbb/ccc/text,
'text_demo1')]
but I have aaa[1] AND aaa[2] and I only want aaa[1]
I thought :
/jcr:root//element(*, bbb) [@tag='1' and jcr:contains(@ccc/text,
'text_demo1')]
and then go to bbb's parent. But I readed that parent axis is not supported
by jackrabbit.
Can someone help me?
Thanks
Re: searching with xpath
Posted by Marcel Reutegger <ma...@gmx.net>.
Hi,
2009/7/16 Fidel García Quesada <fi...@gmail.com>:
> Hi, this is a simple question but i am newbie with jackrabbit and xpath
>
> I have this in my repository:
>
> ..../aaa[1]/bbb[1]/tag = "1"
> ..../aaa[1]/bbb[1]/ccc/text = "text_demo1"
> ..../aaa[1]/bbb[2]/tag = "2"
> ..../aaa[1]/bbb[2]/ccc/text = "text_demo2"
> ..../aaa[2]/bbb[1]/tag = "1"
> ..../aaa[2]/bbb[1]/ccc/text = "text_demo3"
> ..../aaa[2]/bbb[2]/tag = "2"
> ..../aaa[2]/bbb[2]/ccc/text = "text_demo1"
>
>
> i want select aaa who contains ((bbb with tag=1) AND (bbb(the same) who
> contains ccc with text_demo1)), that's aaa[1]
>
> I tried :
> /jcr:root//element(*, aaa) [@bbb/tag='1' and jcr:contains(@bbb/ccc/text,
> 'text_demo1')]
>
> but I have aaa[1] AND aaa[2] and I only want aaa[1]
>
>
> I thought :
> /jcr:root//element(*, bbb) [@tag='1' and jcr:contains(@ccc/text,
> 'text_demo1')]
>
> and then go to bbb's parent. But I readed that parent axis is not supported
> by jackrabbit.
it will be supported in the 2.0 release.
for now you'll have to do that step manually when you iterate over the
result set.
regards
marcel