try {
parser.ReInit(new StringReader(expression));
expr = parser.parseExpression();
}
catch (TokenMgrError e) {
throw new JXPathInvalidSyntaxException(
"Invalid XPath: '"
+ addEscapes(expression)
+ "'. Invalid symbol '"
+ addEscapes(String.valueOf(e.getCharacter()))
+ "' "
+ describePosition(expression, e.getPosition()));
}
catch (ParseException e) {
throw new JXPathInvalidSyntaxException(
"Invalid XPath: '"
+ addEscapes(expression)
+ "'. Syntax error "
+ describePosition(
expression,