WG: AW: Extract text from XML, pay attention to XML Entities

Поиск
Список
Период
Сортировка
Искать

WG: AW: Extract text from XML, pay attention to XML Entities

От:
Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de>
Дата:
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  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  
Gesendet: Dienstag, 29. September 2026 17:49
An: Färber, Franz-Josef (StMUK) ; David G. Johnston 
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  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

AW: AW: Extract text from XML, pay attention to XML Entities

От:
Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@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)  
Gesendet: Mittwoch, 30. September 2026 10:39
An: pgsql-hackers@lists.postgresql.org
Cc: David G. Johnston ; Adrian Klaver 
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  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  
Gesendet: Dienstag, 29. September 2026 17:49
An: Färber, Franz-Josef (StMUK) ; David G. Johnston 
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  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

Re: Extract text from XML, pay attention to XML Entities

От:
"David G. Johnston" <david.g.johnston@gmail.com>
Дата:
On Tuesday, October 20, 2026, Färber, Franz-Josef (StMUK) <Franz-Josef.Faerber@stmuk.bayern.de> wrote:
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.


You might need to scratch your own itch…though the fact we are in the final month of the new release and have a flood of bug reports to deal with for existing features doesn’t bode well for something like this getting meaningful attention right now.

David J.

FAQ