The only characters that should need special treatment inside a string literal are the quote mark used as the string delimiter, and ampersand. These characters must be escaped. There's nothing special about backslash, *, etc, so I suspect that the problem is on the Java side and not the XQuery side.
 
Michael Kay


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Kofman, Irena
Sent: 05 October 2004 15:41
To: saxon-help@lists.sourceforge.net
Subject: [saxon] spesial characters in query

Hello!

If I try to compile a query that looks like:

 

 

      Query = “for $e in /*/*[string(.)='"+searchString+"'] order by string($e) return $e”;

      XQueryExpression exp = xquery.compileQuery(Query);

 

And searchString contains characters like ‘,\,* and some more, I get exceptions.

What can I do about it?

      Thank you

            Irena