You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Sean Callan <se...@gmail.com> on 2008/01/16 16:03:01 UTC
XPath & Retrieving parents
Hi Guys, I've got a question about the XPath within JackRabbit.
I'm currently using this XPath which successfully returns a node,
`//webfmis:role[@webfmis:general='true']` , I'd like to be able to
return the parent node but I'm having absolutely no success in
incorporating `parent::` or `/..`.
When I use `parent::` for instance there are no errors but no node is
returned. I've viewed the repository with JCR Web Explorer and I have
confirmed it does in fact go webfmis:document -> webfmis:properties
-> webfmis:role -> @webfmis:general.
I'm looking to return the webfmis:document. Any idea what I'm missing here?
Thanks,
Sean
Re: XPath & Retrieving parents
Posted by Marcel Reutegger <ma...@gmx.net>.
Sean Callan wrote:
> javax.jcr.query.InvalidQueryException: Only attribute axis is allowed
> in predicate
>
> Currently I am not using 1.4, is this issue resolved in 1.4?
child axis support in predicates has been implemented in 1.2.1 already. see:
https://issues.apache.org/jira/browse/JCR-247
regards
marcel
Re: XPath & Retrieving parents
Posted by Sean Callan <se...@gmail.com>.
Hi Marcel,
I appreciate your prompt response. I tried the XPath as you provided
but it results in an exception :
javax.jcr.query.InvalidQueryException: Only attribute axis is allowed
in predicate
Currently I am not using 1.4, is this issue resolved in 1.4?
On Jan 16, 2008 10:14 AM, Marcel Reutegger <ma...@gmx.net> wrote:
> Hi Sean,
>
> Sean Callan wrote:
> > Hi Guys, I've got a question about the XPath within JackRabbit.
> >
> > I'm currently using this XPath which successfully returns a node,
> > `//webfmis:role[@webfmis:general='true']` , I'd like to be able to
> > return the parent node but I'm having absolutely no success in
> > incorporating `parent::` or `/..`.
>
> jackrabbit does not support the parent axis in queries, which means it should
> actually throw an exception in that case.
>
> > When I use `parent::` for instance there are no errors but no node is
> > returned. I've viewed the repository with JCR Web Explorer and I have
> > confirmed it does in fact go webfmis:document -> webfmis:properties
> > -> webfmis:role -> @webfmis:general.
> >
> > I'm looking to return the webfmis:document. Any idea what I'm missing here?
>
> //*[webfmis:role/@webfmis:general='true']
>
> will work.
>
> regards
> marcel
>
Re: XPath & Retrieving parents
Posted by Marcel Reutegger <ma...@gmx.net>.
Hi Sean,
Sean Callan wrote:
> Hi Guys, I've got a question about the XPath within JackRabbit.
>
> I'm currently using this XPath which successfully returns a node,
> `//webfmis:role[@webfmis:general='true']` , I'd like to be able to
> return the parent node but I'm having absolutely no success in
> incorporating `parent::` or `/..`.
jackrabbit does not support the parent axis in queries, which means it should
actually throw an exception in that case.
> When I use `parent::` for instance there are no errors but no node is
> returned. I've viewed the repository with JCR Web Explorer and I have
> confirmed it does in fact go webfmis:document -> webfmis:properties
> -> webfmis:role -> @webfmis:general.
>
> I'm looking to return the webfmis:document. Any idea what I'm missing here?
//*[webfmis:role/@webfmis:general='true']
will work.
regards
marcel