commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mukherjee, Bakul" <>
Subject [jxpath] escape dollar character in Xpath expression
Date Thu, 22 Jul 2010 23:27:44 GMT

I am using JXPath 1.3 and trying to evaluate a XPath expression that has the '$' character
in it.

My path looks like this: "//data/filter$SearchURN" and I get this error:

    [junit]  WARN (JexlExpression:evaluate) - Caught exception evaluating: org.apache.commons.jexl.ExpressionImpl@51ef4e.
Reason: org.apache.commons.jxpath.JXPathInvalidSyntaxException: Invalid XPath: '//data/filter$SearchURN'.
Syntax error after: '//data/f'
    [junit] org.apache.commons.jxpath.JXPathInvalidSyntaxException: Invalid XPath: '//data/filter$SearchURN'.
Syntax error after: '//data/f'

 My suspicion is that the $ sign is causing the following text to be treated as a variable.
I tried escaping it with '\' and '$' but that didn't solve the problem. I even tried replacing
$ with '&#36;'. That did not work etiher.

Is there a way to escape the dollar sign so that it is taken literally and not treated as
a special character?


The information contained in this email message and its attachments is intended only for the
private and confidential use of the recipient(s) named above, unless the sender expressly
agrees otherwise. Transmission of email over the Internet is not a secure communications medium.
If you are requesting or have requested the transmittal of personal data, as defined in applicable
privacy laws by means of email or in an attachment to email, you must select a more secure
alternate means of transmittal that supports your obligations to protect such personal data.
If the reader of this message is not the intended recipient and/or you have received this
email in error, you must take no action based on the information in this email and you are
hereby notified that any dissemination, misuse or copying or disclosure of this communication
is strictly prohibited. If you have received this communication in error, please notify us
immediately by email and delete the original message. 
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message