A formatter for outputting an XML document, with three pre-defined formats that can be further
customized.
// Log an XML document with specified formatting options.
var xml = '<root><a><b>Text!</b><b>More text!</b></a></root>';
var document = XmlService.parse(xml);
var output = XmlService.getCompactFormat()
.setLineSeparator('\n')
.setEncoding('UTF-8')
.setIndent(' ')
.format(document);
Logger.log(output);
A formatter for outputting an XML document, with three pre-defined formats that can be further customized.