I'm trying to run this line xdmp:unquote(concat('<info>', string( $paragraph) , '</info>'))
but I've got the following error: xdmp:unquote("<info>LEARNING & MEMORY</info>") -- Invalid entity reference " " at line 1
. It seems like this entity reference &
is causing the problem. I tried to remove it using replace
function but it still present. What should I do?
I am assuming that you have something like this-
let $paragraph := <p>LEARNING & MEMORY</p>
return
xdmp:unquote(fn:concat('<info>', fn:string($paragraph),'</info>'))
And that the result you want is XML that looks like-
<info>LEARNING & MEMORY</info>
The ampersand is definitely the issue and the workaround is to use the "repair-full" option. This example works:
let $paragraph := <p>LEARNING & MEMORY</p>
let $contents := xdmp:unquote($paragraph, "", "repair-full")
return
<info>{$contents}</info>