jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Reschke <julian.resc...@gmx.de>
Subject Re: Xpath to SQL Query with a number and subselect
Date Sun, 20 May 2007 11:47:46 GMT
Amir Mistric wrote:
> Hi
> 
> I was wondering if someone can help me translate a Xpath query into SQL one.
> The XPath query works like a charm untill you pass in a path with a number....
> 
> WORKS:
> /jcr:root/site1/news//element(*,nt:base)[@tag='news' and MetaData/@mgnl:template='np-article']
order by @date descending
> 
> FAILS:
> /jcr:root/site1/news/2007//element(*,nt:base)[@tag='news' and MetaData/@mgnl:template='np-article']
order by @date descending
> 
> Reason why it fails is outlined here (http://issues.apache.org/jira/browse/JCR-579)

Well, read that entirely and you'll find out that there is no bug, and 
that you need to escape the leading digit:

/jcr:root/site1/news/_x0032_007//element(*,nt:base)[@tag='news' and 
MetaData/@mgnl:template='np-article'] order by @date descending

> My attempts to convert this to SQL query have failed as it seems impossible to put child
into a predicate...
> Here is what I have (but it does not work):

For conversion between JCR query languages, 
<http://people.apache.org/~mreutegg/jcr-query-translator/translator.html> 
is your friend.

> ...

Best regards, Julian

Mime
View raw message