From: Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>
To: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Subject: AW: AW: Extract text from XML, pay attention to XML Entities
Date: Tue, 20 Oct 2026 13:12:03 +0000
Message-ID: <7266cccdd4b0455b8d4484b40eee4f9a@stmuk.bayern.de> (raw)
In-Reply-To: <9bc204234fb842eda58d36e7e45a0280@stmuk.bayern.de>
References: <615fa488caa2422393498300d476dcc0@stmuk.bayern.de>
<4ba2604dc46b4f58ad500febc7f6e895@stmuk.bayern.de>
<CAKFQuwYa3reOXUAtf_CqBbC5P1FOwyzrkFK0uxochhcpGXrx-A@mail.gmail.com>
<ed1a375c6fe6475892ac1e222cb463bd@stmuk.bayern.de>
<ed34652f-62ad-4b64-a12f-cb4640dfeeeb@aklaver.com>
<9bc204234fb842eda58d36e7e45a0280@stmuk.bayern.de>
Dear Mailing List,
any attention to this post?
I claim there is no sane way to un-escape xml text besides xml2.xpath_string, which is deprecated.
Regards,
Franz-Josef Färber
-----Ursprüngliche Nachricht-----
Von: Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>
Gesendet: Mittwoch, 30. September 2026 10:39
An: pgsql-hackers@lists.postgresql.org
Cc: David G. Johnston <david.g.johnston@gmail.com>; Adrian Klaver <adrian.klaver@aklaver.com>
Betreff: WG: AW: Extract text from XML, pay attention to XML Entities
Dear Mailing List,
this is a re-post of https://www.postgresql.org/message-id/615fa488caa2422393498300d476dcc0%40stmuk.bayern.de .
Thanks to Adrian Klaver, who pointed out here that this question could be right on this mailing list.
To sum up the discussion,
* The xml2 extension contains the function xml_string, which allows to extract text nodes, thereby un-escaping XML, i. e. " foo < bar" becomes "foo < bar".
* (But the xml2 xml_string function won't deal with namespaces as far as I understand.)
* This functionality is missing in the newer API (see the first link for more elaboration on that).
* And as https://www.postgresql.org/docs/current/xml2.html states, " please explain your issue to <pgsql-hackers@lists.postgresql.org> so that the deficiency can be addressed".
Any suggestions or any plans to add similar functionality to the newer API?
Thank You.
Regards,
Franz-Josef Färber
-----Ursprüngliche Nachricht-----
Von: Adrian Klaver <adrian.klaver@aklaver.com>
Gesendet: Dienstag, 29. September 2026 17:49
An: Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>; David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Betreff: Re: AW: Extract text from XML, pay attention to XML Entities
On 9/29/26 6:12 AM, Färber, Franz-Josef (StMUK) wrote:
> Hello David,
>
> Thanks for your reply.
>
> It’s just strange and unfortunate that
>
> a) Postgres does not offer a simple solution
I think you are left with from here:
https://www.postgresql.org/docs/current/xml2.html
"If you find that some of the functionality of this module is not available in an adequate form with the newer API, please explain your issue to <pgsql-hackers@lists.postgresql.org> so that the deficiency can be addressed."
>
> b) Postgres had indeed offered a simple solution, xml_string, in the
> xml2 extension, which is deprecated (and won't deal with namespaces).
>
> Regards,
>
> Franz-Josef Färber
--
Adrian Klaver
adrian.klaver@aklaver.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: Franz-Josef.Faerber@stmuk.bayern.de, pgsql-hackers@lists.postgresql.org
Subject: Re: Extract text from XML, pay attention to XML Entities
In-Reply-To: <7266cccdd4b0455b8d4484b40eee4f9a@stmuk.bayern.de>
References: <615fa488caa2422393498300d476dcc0@stmuk.bayern.de> <4ba2604dc46b4f58ad500febc7f6e895@stmuk.bayern.de> <CAKFQuwYa3reOXUAtf_CqBbC5P1FOwyzrkFK0uxochhcpGXrx-A@mail.gmail.com> <ed1a375c6fe6475892ac1e222cb463bd@stmuk.bayern.de> <ed34652f-62ad-4b64-a12f-cb4640dfeeeb@aklaver.com> <9bc204234fb842eda58d36e7e45a0280@stmuk.bayern.de> <7266cccdd4b0455b8d4484b40eee4f9a@stmuk.bayern.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox