2

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 &amp; MEMORY</info>") -- Invalid entity reference " " at line 1. It seems like this entity reference &amp; is causing the problem. I tried to remove it using replace function but it still present. What should I do?

Stephen Swensen
  • 22,107
  • 9
  • 81
  • 136
s.e
  • 271
  • 2
  • 15

1 Answers1

5

I am assuming that you have something like this-

let $paragraph := <p>LEARNING &amp; 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 &amp; MEMORY</p>
let $contents := xdmp:unquote($paragraph, "", "repair-full")
return
<info>{$contents}</info>
Harry Bakken
  • 693
  • 6
  • 11