You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Paco Avila <pa...@git.es> on 2007/02/26 12:42:38 UTC

problem escaping reserved characters in XPath

According to the specification (6.6.5.2) jcr:contains() expression must
be escaped if it includes some characters like ' , but my query fails:

	//element(*,okm:document)[jcr:contains(@okm:name,'\'eee')]

Lexical error at line 1, column 79. Encountered:  after : "\')] return
$v": Lexical error at line 1, column 79. Encountered:  after : "\')]
return $v"

-- 
GIT Consultors S.L.
c\ Francesc Rover 2-B
07003 Palma de Mallorca
(Illes Balears)


Re: problem escaping reserved characters in XPath

Posted by Paco Avila <pa...@git.es>.
El lun, 26-02-2007 a las 12:46 +0100, Cédric Damioli escribió:
> AFAIK, ' characters must be escaped twice in jcr:contains() query : once 
> for XPath (with two '), once for jcr:contains (with a \).
> Your query should be :
> 
> //element(*,okm:document)[jcr:contains(@okm:name,'\''eee')]

Ok, thanks! 

> 
> 
> Paco Avila a écrit :
> > According to the specification (6.6.5.2) jcr:contains() expression must
> > be escaped if it includes some characters like ' , but my query fails:
> >
> > 	//element(*,okm:document)[jcr:contains(@okm:name,'\'eee')]
> >
> > Lexical error at line 1, column 79. Encountered:  after : "\')] return
> > $v": Lexical error at line 1, column 79. Encountered:  after : "\')]
> > return $v"
> >
> >   
> 
-- 
GIT Consultors S.L.
c\ Francesc Rover 2-B
07003 Palma de Mallorca
(Illes Balears)


Re: problem escaping reserved characters in XPath

Posted by Marcel Reutegger <ma...@gmx.net>.
Paco Avila wrote:
> Which other chars must be encoded for XPath. I'm looking for them but
> don't find anything more than the ' :(

none, ' is the only one if you use ' to enclose a string.

similarly, if you use " to enclose a string you need to escape the ".

See: http://www.w3.org/TR/xpath20/#doc-xpath-StringLiteral

regards
  marcel

Re: problem escaping reserved characters in XPath

Posted by Paco Avila <pa...@git.es>.
El lun, 26-02-2007 a las 12:46 +0100, Cédric Damioli escribió:
> AFAIK, ' characters must be escaped twice in jcr:contains() query : once 
> for XPath (with two '), once for jcr:contains (with a \).
> Your query should be :
> 
> //element(*,okm:document)[jcr:contains(@okm:name,'\''eee')]

Which other chars must be encoded for XPath. I'm looking for them but
don't find anything more than the ' :(

-- 
GIT Consultors S.L.
c\ Francesc Rover 2-B
07003 Palma de Mallorca
(Illes Balears)


Re: problem escaping reserved characters in XPath

Posted by Cédric Damioli <ce...@anyware-tech.com>.
AFAIK, ' characters must be escaped twice in jcr:contains() query : once 
for XPath (with two '), once for jcr:contains (with a \).
Your query should be :

//element(*,okm:document)[jcr:contains(@okm:name,'\''eee')]

Regards,
Cédric


Paco Avila a écrit :
> According to the specification (6.6.5.2) jcr:contains() expression must
> be escaped if it includes some characters like ' , but my query fails:
>
> 	//element(*,okm:document)[jcr:contains(@okm:name,'\'eee')]
>
> Lexical error at line 1, column 79. Encountered:  after : "\')] return
> $v": Lexical error at line 1, column 79. Encountered:  after : "\')]
> return $v"
>
>   

-- 
Cédric Damioli
ANYWARE TECHNOLOGIES
Tel : +33 (0)5 61 00 73 47
Fax : +33 (0)5 61 00 51 46
http://www.anyware-tech.com