Given this in a grails action:
def xml = {
rss(version: '2.0') {
...
}
}
render(contentType: 'application/rss+xml', xml)
I see this:
<rss><channel><title></title><description></description><link></link><item></item></channel></rss>
Is there an easy way to pretty print the XML? Something built into the render method, perhaps?
According to the reference docs, you can use the following configuration option to enable pretty printing:
Use MarkupBuilder to pretty-print your Groovy xml
This is a simple way to pretty-print XML, using Groovy code only:
results in:
Use XmlUtil :