I'm having trouble with xpath() in PostgreSQL. For example...
WITH x(col) AS (
SELECT '<?xml version="1.0" ?><response><status>ERROR & DATA</status></response>'::xml)
SELECT xpath('//status/text()', col) AS status
FROM x
I would like this to return ERROR & DATA but instead it returns ERROR & DATA, leaving the XML entity encoded. How can I decode this in Postgres?