[PATCH] Add pretty-printed XML output option
Jim Jones <jim.jones@uni-muenster.de>
From: Jim Jones <jim.jones@uni-muenster.de>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-02-02T20:35:39Z
Lists: pgsql-hackers
Attachments
- v1-0001-Add-pretty-printed-XML-output-option.patch (text/x-patch) patch v1-0001
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
Commits
-
Fix memory leak in XMLSERIALIZE(... INDENT).
- f24605e2dc16 18.0 landed
- ee58de10084b 16.10 landed
- 20bae0690322 17.6 landed
-
doc: Move documentation of md5_password_warnings to a better place
- f3622b64762b 18.0 cited
-
Support [NO] INDENT option in XMLSERIALIZE().
- 483bdb2afec9 16.0 landed
-
Add an expected-file to match behavior of latest libxml2.
- 085423e3e326 9.6.0 cited