Re: extract text from XML - Mailing list pgsql-hackers

From Tobias Bussmann
Subject Re: extract text from XML
Date
Msg-id 74B01E67-14A6-46F1-8812-E8E3E58AD861@gmx.net
Whole thread Raw
In response to extract text from XML  (Chris Pacejo <chris@pacejo.net>)
List pgsql-hackers
> I have found a basic use case which is supported by the xml2 module,
> but is unsupported by the new XML API.
> It is not possible to correctly extract text

Indeed. I came accross this shortcomming some months ago myself but still manage an item on my ToDo list to report it
hereas the deprecation notice at https://www.postgresql.org/docs/devel/static/xml2.html#AEN180625 asks for. Done,
thanks;) 

I did some archive-browsing on that topic. The issue (if you want to call it that way) was introduced by an patch to
ensurexpath() always returns xml, applied for 9.2 after some discussion:
https://www.postgresql.org/message-id/201106291934.23089.rsmogura%40softperience.euand is since then known:
https://www.postgresql.org/message-id/1409795403248-5817667.post%40n5.nabble.comThe new behaviour was later reported as
abug and discussed again:
https://www.postgresql.org/message-id/CAAY5AM1L83y79rtOZAUJioREO6n4%3DXAFKcGu6qO3hCZE1yJytg%40mail.gmail.com

Anyhow - (un)escaping functions to support the text<->xml conversion are often talked about but still seem only to be
foundin xml2 module. Seeing a xmltable implementing patch here recently, these functions would be another step to make
thecontrib module obsolete, finally. 

> Perhaps a function xpath_value(text, xml) -> text[] would close the gap?

such an design, resembling the xml2 behaviour, would certainly fit the need, imho.

regards
Tobias


pgsql-hackers by date:

Previous
From: Petr Jelinek
Date:
Subject: Re: Logical Replication WIP
Next
From: Oleg Bartunov
Date:
Subject: Re: 9.6 phrase search distance specification