Menu

#3 net.sf.xqparser.ParseException: Encountered " <Char> "\' "" at line 1, column 15. on XPath query concat($var1, ' &')

v1.0.1
wont-fix
None
5
2015-08-06
2015-08-06
No

When trying to call xpath.XPath2() on xpath expression "concat($var1, ' &')" I encounter the following error.

Full stack trace:
net.sf.xqparser.ParseException: Encountered " <char> "\' "" at line 1, column 15.
Was expecting one of:
"xquery" ...
"version" ...
"encoding" ...
"module" ...
"namespace" ...
"declare" ...
"boundary-space" ...
"preserve" ...
"strip" ...
"default" ...
"element" ...
"function" ...
"option" ...
"ordering" ...
"ordered" ...
"unordered" ...
"order" ...
"empty" ...
"copy-namespaces" ...
"no-preserve" ...
"inherit" ...
"no-inherit" ...
"collation" ...
"base-uri" ...
"import" ...
"schema" ...
"at" ...
"variable" ...
"$" ...
"construction" ...
"(" ...
"as" ...
"return" ...
"for" ...
"in" ...
"let" ...
"where" ...
"by" ...
"stable" ...
"some" ...
"every" ...
"satisfies" ...
"typeswitch" ...
"case" ...
"if" ...
"then" ...
"else" ...
"or" ...
"and" ...
"to" ...
"*" ...
"div" ...
"idiv" ...
"mod" ...
"union" ...
"intersect" ...
"except" ...
"instance" ...
"of" ...
"treat" ...
"castable" ...
"cast" ...
"eq" ...
"ne" ...
"lt" ...
"le" ...
"gt" ...
"ge" ...
"is" ...
"validate" ...
"lax" ...
"strict" ...
"child" ...
"descendant" ...
"attribute" ...
"self" ...
"descendant-or-self" ...
"following-sibling" ...
"following" ...
"@" ...
"parent" ...
"ancestor" ...
"preceding-sibling" ...
"preceding" ...
"ancestor-or-self" ...
".." ...
"." ...
"document" ...
"text" ...
"comment" ...
"processing-instruction" ...
"empty-sequence" ...
"item" ...
"node" ...
"document-node" ...
"schema-attribute" ...
"schema-element" ...
"first" ...
"last" ...
"into" ...
"after" ...
"before" ...
"insert" ...
"nodes" ...
"delete" ...
"replace" ...
"value" ...
"rename" ...
"copy" ...
"modify" ...
"update" ...
"transform" ...
"do" ...
"type" ...
<integerliteral> ...
<decimalliteral> ...
<doubleliteral> ...
<stringliteral> ...
"-" ...
"+" ...
"external" ...
"ascending" ...
"descending" ...
"greatest" ...
"least" ...
"<" ...
"<" ...
"(#" ...
"<?" ...
"<?" ...
"<!--" ...
"<!--" ...
"/" ...
"//" ...
<qnametoken> ...
<ncnamecolonstar> ...
<starcolonncname> ...
"xquery" ...
"xquery" ...
"xquery" ...
"xquery" ...
"xquery" ...
"module" ...
"module" ...
"module" ...
"module" ...
"for" ...
"let" ...
"some" ...
"every" ...
"typeswitch" ...
"if" ...
"insert" ...
"delete" ...
"rename" ...
"replace" ...
"copy" ...</starcolonncname></ncnamecolonstar></qnametoken></stringliteral></doubleliteral></decimalliteral></integerliteral></char>

I tried to alter xquery-update-grammar.jjt but it fails to compile...
This is the fix I wanted to try:
@line 3305 change: < PredefinedEntityRef >
| < CharRef >
| < EscapeQuot >
| ~[ "\"" ]
to: < EscapeQuot >
| ~[ "\"" ]

@line 3318 change: < PredefinedEntityRef >
| < CharRef >
| < EscapeApos >
| ~[ "'", "&" ]

to: < EscapeApos >
| ~[ "'" ]

Thanks in advance

1 Attachments

Discussion

  • leejinRMX

    leejinRMX - 2015-08-06
    • status: unread --> accepted
    • assigned_to: leejinRMX
     
  • leejinRMX

    leejinRMX - 2015-08-06
    • status: accepted --> wont-fix
     
  • leejinRMX

    leejinRMX - 2015-08-06

    Hi,
    There is a problem in your expression: the entity is not correctly formatted.
    The '&' character alone is forbidden and need always to start an entity reference.
    Use "concat($var1, ' &')" to solve your problem.
    You can check your syntaxt using: http://www.xpathtester.com/xquery
    Try with "concat('', ' &')" to see a more human readable error :)

    Bests regards,

    Damien

     

Log in to post a comment.

Auth0 Logo