Re: [PATCH] Add pretty-printed XML output option

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Add pretty-printed XML output option
Date: 2023-02-17 09:14:46
Message-ID: beb5a47d-4684-4b2f-8647-bacb6bd60acf@uni-muenster.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16.02.23 05:38, Nikolay Samokhvalov wrote:
> On Thu, Feb 9, 2023 at 2:31 AM Peter Eisentraut
> <peter(dot)eisentraut(at)enterprisedb(dot)com> wrote:
>
> I suggest we call it "xmlformat", which is an established term for
> this.
>
>
> Some very-very old, rusted memory told me that there was something in
> standard – and indeed, it seems it described an optional Feature X069,
> “XMLSerialize: INDENT” for XMLSERIALIZE. So probably pretty-printing
> should go there, to XMLSERIALIZE, to follow the standard?
>
> Oracle also has an option for it in XMLSERIALIZE, although in a
> slightly different form, with ability to specify the number of spaces
> for indentation
> https://docs.oracle.com/database/121/SQLRF/functions268.htm#SQLRF06231.

After your comment I'm studying the possibility to extend the existing
xmlserialize function to add the indentation feature. If so, how do you
think it should look like? An extra parameter? e.g.

SELECT xmlserialize(DOCUMENT '<foo><bar>42</bar></foo>'::XML AS text,
true);

.. or more or like Oracle does it

SELECT XMLSERIALIZE(DOCUMENT xmltype('<foo><bar>42</bar></foo>') AS BLOB
INDENT)
FROM dual;

Thanks!

Best, Jim

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2023-02-17 09:15:07 Re: Support logical replication of DDLs
Previous Message Etsuro Fujita 2023-02-17 08:45:51 Doc: Improve note about copying into postgres_fdw foreign tables in batch