Reputation: 213
I am trying to update the text value of a node using xquery. What I have works just fine for numbers and simple text, but I am having issues with special characters.
Usually, when handling xml, I just replace &
with &
and things work fine. In the case of my updating expression though, I get a "Expecting quote." error.
These works:
replace value of node $v with "testers"
replace value of node $v with "tester's"
replace value of node $v with "tester A and tester B"
These fail:
replace value of node $v with "tester A & tester B"
replace value of node $v with "tester A & tester B"
Ideally, I would also be replacing "
with "
but I can't do this until I am able to pass the &
(or some substitute) via xquery.
Upvotes: 0
Views: 196
Reputation: 295619
This does in fact work correctly, as tested with the following document against BaseX 8.2:
declare context item := document { <root><txt>old</txt></root> };
copy $c := /root/txt
modify replace value of node $c with "foo & bar"
return $c
...which correctly yields:
<txt>foo & bar</txt>
Upvotes: 2