You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Christophe Lombart <ch...@gmail.com> on 2005/10/29 01:23:56 UTC

Query on version nodes

Hi all,

I cannot search correctly on version nodes.
In fact, I'm getting version node paths from the version history by
using the JCR API. That works correctly but I got an exception when I
build a query like this  :

/jcr:system/jcr:versionStorage/e8/5a/3b/e85a3b3b-942f-4b98-9b92-efceaad07352/1.0//element(*,graffito:paragraph)

Is it not a correct query ?

Here is the exception :
 javax.jcr.query.InvalidQueryException: Encountered "/" at line 1, column 47.
Was expecting one of:
    <IntegerLiteral> ...
    <DecimalLiteral> ...
    <DoubleLiteral> ...
    <StringLiteral> ...
    "<?" ...
    "<?" ...
    <AxisChild> ...
    <AxisDescendant> ...
    <AxisParent> ...
    <AxisAttribute> ...
    <AxisSelf> ...
    <AxisDescendantOrSelf> ...
    <AxisAncestor> ...
    <AxisFollowingSibling> ...
    <AxisPrecedingSibling> ...
    <AxisFollowing> ...
     .....


Thanks,
Christophe

Re: Query on version nodes

Posted by Marcel Reutegger <ma...@gmx.net>.
Angela Schreiber wrote:
>> I'll probably move it to a package that is included with the 
>> jackrabbit-commons module in the near future.
> 
> just let me know, so i can finally get rid of the copy :)

done, svn revision: 330575

time for your first jackrabbit commit?

regards
  marcel

Re: Query on version nodes

Posted by Angela Schreiber <an...@day.com>.
> you may use the class o.a.j.core.util.ISO9075 which is currently in a 
> core package.

and for this exact reason ('core') there is also a copy of this
class in the o.a.j.util package in the jcr-server contrib...

> I'll probably move it to a package that is included with the 
> jackrabbit-commons module in the near future.

just let me know, so i can finally get rid of the copy :)

regards
angela

Re: Query on version nodes

Posted by Marcel Reutegger <ma...@gmx.net>.
you may use the class o.a.j.core.util.ISO9075 which is currently in a 
core package.

I'll probably move it to a package that is included with the 
jackrabbit-commons module in the near future.

regards
  marcel

Christophe Lombart wrote:
> Marcel,
> 
> Thanks for your reply.
> Are there some utility methods to encode properly ?
> 
> Christophe
> 
> On 10/31/05, Marcel Reutegger <ma...@gmx.net> wrote:
> 
>>Hi Christophe,
>>
>>that's because xpath does not allow names that start with a digit, you
>>need to encode them properly.
>>
>>e.g. if you are looking for the 1.0 nodes your query would be:
>>
>>/jcr:root/jcr:system//_x0031_.0
>>
>>regards
>>  marcel
>>

Re: Query on version nodes

Posted by Christophe Lombart <ch...@gmail.com>.
Marcel,

Thanks for your reply.
Are there some utility methods to encode properly ?

Christophe

On 10/31/05, Marcel Reutegger <ma...@gmx.net> wrote:
> Hi Christophe,
>
> that's because xpath does not allow names that start with a digit, you
> need to encode them properly.
>
> e.g. if you are looking for the 1.0 nodes your query would be:
>
> /jcr:root/jcr:system//_x0031_.0
>
> regards
>   marcel
>
> Christophe Lombart wrote:
> > Hi all,
> >
> > I cannot search correctly on version nodes.
> > In fact, I'm getting version node paths from the version history by
> > using the JCR API. That works correctly but I got an exception when I
> > build a query like this  :
> >
> > /jcr:system/jcr:versionStorage/e8/5a/3b/e85a3b3b-942f-4b98-9b92-efceaad07352/1.0//element(*,graffito:paragraph)
> >
> > Is it not a correct query ?
> >
> > Here is the exception :
> >  javax.jcr.query.InvalidQueryException: Encountered "/" at line 1, column 47.
> > Was expecting one of:
> >     <IntegerLiteral> ...
> >     <DecimalLiteral> ...
> >     <DoubleLiteral> ...
> >     <StringLiteral> ...
> >     "<?" ...
> >     "<?" ...
> >     <AxisChild> ...
> >     <AxisDescendant> ...
> >     <AxisParent> ...
> >     <AxisAttribute> ...
> >     <AxisSelf> ...
> >     <AxisDescendantOrSelf> ...
> >     <AxisAncestor> ...
> >     <AxisFollowingSibling> ...
> >     <AxisPrecedingSibling> ...
> >     <AxisFollowing> ...
> >      .....
> >
> >
> > Thanks,
> > Christophe
> >
> >
>

Re: Query on version nodes

Posted by Marcel Reutegger <ma...@gmx.net>.
Hi Christophe,

that's because xpath does not allow names that start with a digit, you 
need to encode them properly.

e.g. if you are looking for the 1.0 nodes your query would be:

/jcr:root/jcr:system//_x0031_.0

regards
  marcel

Christophe Lombart wrote:
> Hi all,
> 
> I cannot search correctly on version nodes.
> In fact, I'm getting version node paths from the version history by
> using the JCR API. That works correctly but I got an exception when I
> build a query like this  :
> 
> /jcr:system/jcr:versionStorage/e8/5a/3b/e85a3b3b-942f-4b98-9b92-efceaad07352/1.0//element(*,graffito:paragraph)
> 
> Is it not a correct query ?
> 
> Here is the exception :
>  javax.jcr.query.InvalidQueryException: Encountered "/" at line 1, column 47.
> Was expecting one of:
>     <IntegerLiteral> ...
>     <DecimalLiteral> ...
>     <DoubleLiteral> ...
>     <StringLiteral> ...
>     "<?" ...
>     "<?" ...
>     <AxisChild> ...
>     <AxisDescendant> ...
>     <AxisParent> ...
>     <AxisAttribute> ...
>     <AxisSelf> ...
>     <AxisDescendantOrSelf> ...
>     <AxisAncestor> ...
>     <AxisFollowingSibling> ...
>     <AxisPrecedingSibling> ...
>     <AxisFollowing> ...
>      .....
> 
> 
> Thanks,
> Christophe
> 
>