Dear all,
we use BaseX version 7.9
BaseX nodes and the XPath query of the getNodes()-method contains the char "&" and an exception is thrown.
Example:
//File[@originalLocation='E:\data\bugs\prom-9366\file & codemodel']/CopiedLocations/CopiedLocation
If we use JDOM Nodes the query does not fail in this case.
Why JDom can execute this query and BaseX cannot?
Is there a general possibility to avoid this special char in a BaseX query, except masked it, or could it be solved in a higher version of BaseX?
best regards
Hi Martin,
In BaseX, all queries are XQuery expressions. As a consequence, ampersands must always be escaped:
//File[@originalLocation='E:\data\bugs\prom-9366\file & codemodel']/CopiedLocations/CopiedLocation
In more recent versions of BaseX (...later than 7.9...), you can take advantage of the XQuery 3.1 string constructor [1]:
//File[@originalLocation=``[E:\data\bugs\prom-9366\file & codemodel]``]/CopiedLocations/CopiedLocation
If we use JDOM Nodes the query does not fail in this case.
Why JDom can execute this query and BaseX cannot?
I know too less about JDom, but I assume that it only provides support for basic XPath 1.0 expressions?
Cheers, Christian
[1] http://docs.basex.org/wiki/XQuery_3.1#String_Constructor
basex-talk@mailman.uni-konstanz.de