I've been trying to extract values from XML the same way as @Erwin Brandstetter answered a few times with an accepted answer, but it just doesn't work for me:
According to this post and this post this should work, but I just get an empty result:
WITH x AS ( SELECT
'<Attributes xmlns="http://www.gis34.dk">
<bemaerkning displayName="Bemærkning">Beatrix</bemaerkning>
<billede displayName="Billede">https://vignette.wikia.nocookie.net/killbill/images/3/39/The_Bride.jpg</billede>
</Attributes>'::xml AS t
)
SELECT xpath('/Attributes/bemaerkning/text()', t) as comment
FROM x
Result: (expected: {My comment})
comment
xml[]
-------
{}
My database version:
PostgreSQL 9.1.3 on x86_64-unknown-linux-gnu, compiled by gcc-4.5.real (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2, 64-bit
Anyone has an idea?