import groovy.xml.XmlUtil .... def xmlString = "YOUR XML STRING"; def xmlAsText = XmlUtil.serialize(xmlString) render(text: xmlAsText, encoding:"UTF-8", contentType:"text/xml")