jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shane O'Sullivan" <shaneosulliv...@gmail.com>
Subject Re: XPath with QName not working
Date Mon, 12 Jun 2006 12:33:36 GMT
On 12/06/06, Marcel Reutegger <marcel.reutegger@gmx.net> wrote:
> > I'm trying to execute XPath on JackRabbit in a data store that
> > contains nodes with namespaces specified.  For example I have:
> >
> > /
> > /jcr:system            (type is rep:system)
> > /a:mynode             (type is nt:unstructured)
> >
> > If I use the query  /*   it gives me the root '/' Node.
> > If I use the query  /*/* it gives me
> >    /jcr:system
> >    /a:mynode
>
> this is expected behaviour. The specification states that the root node
> is represented as /jcr:root in an XPath query. That is, the jcr:system
> node in XPath is referenced with the following query: /jcr:root/jcr:system

Yes, upon further investigation I found this to be the case.  Still, I
find it strange that you have to use /jcr:root in an XPath query,
while node.getPath() never shows the /jcr:root part of the path.
Anyway, I digress...

> > However, I cannot access any node by referencing it without a
> > wildcard.  For example, the query   //a:mynode     does not return any
> > results,  nor does   /a:mynode    or /*/a:mynode
>
> //a:mynode and /*/a:mynode should acutally work. can you please create
> a jira issue that describes this bug? Thanks.

Sure - I'll wait a while to see if anyone else has seen this, or if
they've spotted something I'm doing wrong, and if not I'll write it
up.

> > Neither can I access the jcr:system node directly.  I've also tried
> > without the namespace qualifier, but   //mynode   ,  /mynode   and
> > //system   don't work either.
>
> All queries are namespace sensitive, which means you have to use the
> namespace prefixes.

OK, this is what I expected alright.

> > Also, using the 'element' function doesn't work, e.g.   //element(*,
> > nt:unstructured)   returns nothing, even though I know for a fact that
> > there are nodes of type nt:unstructured in the data store.
>
> This is very weird as this is covered by a lot of test cases in jackrabbit.
> Did you by any chance migrate existing content to a new jackrabbit version?
> E.g. when migrating from 0.9 version of jackrabbit to 1.0 or 1.0.1 you
> have to remove the index directories and re-index the workspaces.

No, this is all brand new test data.  I have tried it using the
release versions 1.0 and 1.0.1, and it's failed on both.  Doing
further testing, I created nodes without a namespace, and repeated the
tests.  I found that that these failed too on 1.0 and 1.0.1 , that is,
nodes would be found with the * wildcard, but not otherwise.  However,
it DID work with the 1.0 Snapshot build I downloaded months ago, the
Jan 20th 2006 1.0 build.  This test involved importing my file system,
creating an nt:unstructured node for each file, so I have:

/jcr:root
/jcr:root/jcr:system
/jcr:root/C
/jcr:root/C/temp

And on the Jan 20th build, the query //C finds the second node above,
as it should, but this fails with the other builds.  The namespaced
XPath queries also work on the Jan 20th build, so the query
//jcr:system   finds the correct node, but if failed on the final 1.0
and 1.0.1 builds



> regards
>  marcel
> --
>
>
> Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
> Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
>

Mime
View raw message