On 16.02.23 05:38, Nikolay Samokhvalov 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?
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