You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Martin Perez <mp...@gmail.com> on 2006/04/06 22:29:21 UTC

Error with XPath queries

Hi.

I think I found a bug with RC3 and XPath queries. Correct me if I'm wrong, I
will try to describe it as good as possible.

On my workspace, the next query does not returns any results:
"/jcr:root//element(*,jlib:jlibrary)[@jlib:id]"

That is fine as the workspace should not have any node with a jlib:id
property.  The property jlib:id is defined for the jlib:jlibrary nodetype
that acts like a base type on my hierarchy.

But, the problem comes with the next query: "/jcr:root//*[@jlib:id]"

This query, on the same workspace without any changes, return a single
result. The result is of jlib:category that is a subtype of jlib:jlibrary,
and so the isNodeType(jlib:jlibrary) method returns true. And even more
interesting, if I perform a getProperty(jlib:id) method call, then I get a
PathNotFoundException. Of course, I have looked on the property state and
the node really do not have that property, but anyways the query returns
that single result!

Seems weird for me. Am I missing something?

Martin

Re: Error with XPath queries

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

Martin Perez wrote:
> I think I found a bug with RC3 and XPath queries. Correct me if I'm wrong, I
> will try to describe it as good as possible.
> 
> On my workspace, the next query does not returns any results:
> "/jcr:root//element(*,jlib:jlibrary)[@jlib:id]"
> 
> That is fine as the workspace should not have any node with a jlib:id
> property.  The property jlib:id is defined for the jlib:jlibrary nodetype
> that acts like a base type on my hierarchy.
> 
> But, the problem comes with the next query: "/jcr:root//*[@jlib:id]"
> 
> This query, on the same workspace without any changes, return a single
> result. The result is of jlib:category that is a subtype of jlib:jlibrary,
> and so the isNodeType(jlib:jlibrary) method returns true. And even more
> interesting, if I perform a getProperty(jlib:id) method call, then I get a
> PathNotFoundException. Of course, I have looked on the property state and
> the node really do not have that property, but anyways the query returns
> that single result!

are you able to reproduce this error with a test script starting from an 
empty repository?

please also note that you need to re-index a repository if you migrate 
existing content to RC3 or 1.0. or did you re-index the repository already?

regards
  marcel