chris_selwyn
15 years agoNew Contributor
How do I get an escaped string rather than CDATA?
I am using the following snippet to set a value in a SOAP request to be an XML string as constructed by a groovy MarkupBuilder
def xml = xmlsw.toString()
log.info("xml = " + xml)
def xmlh = gu.getXmlHolder("TMProcessData#Request")
xmlh.namespaces["ns"]='http://www.tbsmobility.com/TMHost/20041006'
xmlh["//ns:Data"] = xml
However the ns:Data element in the final SOAP request has a CDATA in it rather than escaped XML (with < and >).
Is there a way I can cause the XML to be escaped rather than contained in a CDATA?
Chris
def xml = xmlsw.toString()
log.info("xml = " + xml)
def xmlh = gu.getXmlHolder("TMProcessData#Request")
xmlh.namespaces["ns"]='http://www.tbsmobility.com/TMHost/20041006'
xmlh["//ns:Data"] = xml
However the ns:Data element in the final SOAP request has a CDATA in it rather than escaped XML (with < and >).
Is there a way I can cause the XML to be escaped rather than contained in a CDATA?
Chris