On Thu, May 12, 2022 at 2:45 PM Daniel Gross <daniel@xxxxxxxx> wrote:

You can "add" the "<?xml version ..." tag using the scalar SQL function XMLSERIALIZE like this:

I don't think that is the issue. I'm pretty sure OP already has that,
whether using XMLSERIALIZE or something else.

This article doesn't mention XMLSERIALIZE, yet the version and
encoding declaration is central to his example:

https://www.rpgpgm.com/2018/05/creating-xml-file.html

But it does not "prettify" the XML expression - it simply returns one single result line of XML - and inserting line breaks into XML data is very unusual, because the XML processors (like DOM or SAX) don't need it.

I'm sure OP needs the prettification. No doubt at some point, some
human wants to look it over. And prettification is an extremely common
request.

Jon is absolutely right that postprocessing is the way to go.

I know this is the RPG list, but I have to mention that IBM provides
XML utilities, including a formatter, for free. It's one of the open
source packages for PASE.

Install using the ACS open source package manager, or use the
following at a PASE command line:

yum install libxml2-tools

The actual tool is xmllint. You want the --format option.

John Y.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.