Forum Discussion
Michael_McDonal
16 years agoOccasional Contributor
I've gotten this to work with the CDATA section. I set the response content-type to "application/xml" and placed the CDATA section in a closure:
import groovy.xml.MarkupBuilder
def response = mockRequest.getHttpResponse()
response.setContentType("application/xml")
def writer = response.getWriter()
def xml = new MarkupBuilder( writer )
xml.result {
detail() { xml.yieldUnescaped("<!CDATA[" + "Some text" + "]]>") }
}
writer.close()