I have some text in a node, for example:
<xml><Hello world "&" foo bar></xml>
I would like to process string(/xml)
and JSON-escape it so that the result would be something like:
"<Hello world \"&\" foo bar>"
How can I do it with XPath 3.1?
You can use serialize(string(xml), map{'method': 'json'})