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

From: Nikolay Samokhvalov <samokhvalov(at)gmail(dot)com>
To: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Add pretty-printed XML output option
Date: 2023-02-17 22:24:13
Message-ID: CANNMO+L5X2ynyXL2RK7gTVA-pj=Z8o8FCCr6RwLfRK_LinjSbg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 17, 2023 at 1:14 AM Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> wrote:

> 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;
>

My idea was to follow the SQL standard (part 14, SQL/XML); unfortunately,
there is no free version, but there are drafts at
http://www.wiscorp.com/SQLStandards.html.

<XML character string serialization> ::=
XMLSERIALIZE <left paren> [ <document or content> ]

<XML value expression> AS <data type>
[ <XML serialize bom> ]
[ <XML serialize version> ]
[ <XML declaration option> ]

[ <XML serialize indent> ]
<right paren>

<XML serialize indent> ::=
[ NO ] INDENT

Oracle's extension SIZE=n also seems interesting (including a special case
SIZE=0, which means using new-line characters without spaces for each line).

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-02-17 22:32:43 Re: recovery modules
Previous Message Nathan Bossart 2023-02-17 21:56:24 archive modules loose ends