[PATCH] Add pretty-printed XML output option

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] Add pretty-printed XML output option
Date: 2023-02-02 20:35:39
Message-ID: 2f5df461-dad8-6d7d-4568-08e10608a69b@uni-muenster.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

This small patch introduces a XML pretty print function. It basically
takes advantage of the indentation feature of xmlDocDumpFormatMemory
from libxml2 to format XML strings.

postgres=# SELECT xmlpretty('<foo id="x"><bar id="y"><var
id="z">42</var></bar></foo>');
        xmlpretty
--------------------------
 <foo id="x">            +
   <bar id="y">          +
     <var id="z">42</var>+
   </bar>                +
 </foo>                  +

(1 row)

The patch also contains regression tests and documentation.

Feedback is very welcome!

Jim

Attachment Content-Type Size
v1-0001-Add-pretty-printed-XML-output-option.patch text/x-patch 15.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2023-02-02 20:42:52 Re: Amcheck verification of GiST and GIN
Previous Message Nikolay Samokhvalov 2023-02-02 20:31:33 Re: Amcheck verification of GiST and GIN