Given this in a grails action:
def xml = { rss(version: \'2.0\') { ... } } render(contentType: \'application/rss+xml\', xml)
Use MarkupBuilder to pretty-print your Groovy xml
def writer = new StringWriter() def xml = new MarkupBuilder (writer) xml.rss(version: '2.0') { ... } } render(contentType: 'application/rss+xml', writer.toString())