unexpected character found in xquery code

72 views Asked by At

I am trying to run the following in my query console.

 xquery version "1.0-ml";

 import module namespace functx = "http://www.functx.com" at "/MarkLogic/functx/functx- 
1.0-nodoc-2007-01.xqy";
 let $forestNames := xdmp:forest-name(xdmp:host-forests(xdmp:host()))
let $databaseForestsIds := xdmp:database-forests(xdmp:database("credits-dh-FINAL"))
return functx:value-intersect($forestNames, $databaseForestsIds ! xdmp:forest-name (.)) 

but i am getting below error :-

 [1.0-ml] XDMP-BADCHAR: (err:XPST0003) Unexpected character found ' ' (0x00a0)

The same code when i run in my colleague's machine it works. where is it going wrong?

1

There are 1 answers

0
Mads Hansen On BEST ANSWER

0x00a0 is a no-break space character. Which obviously makes it hard to "see" them, but they are different from a regular space character.

XDMP-BADCHAR

The XQuery lexer found a character where the XQuery language does not permit it to be.

Did you share the code via Teams or some other messaging program? I have found that Teams specifically seems to add in some of those no-break space characters, presumably to help with display - but it makes for issues with code.

In Query Console where that error message is reported, it should also highlight where in the code it's complaining about that character.

Replace those no-break space whitespace characters with a regular space and you should be good. There could be multiple places.