Forum Discussion

kijanee's avatar
11 years ago

CDATA within CDATA and Request Filtering

Hey guys... I really need some help. I have a response XML that has 2 CDATA tags. Naturally I want to filter both CDATAs so I can get to each individual value to pass to my datasink. I am using Request Filter.after Request to filter the CDATA. My issue is that only the first CDATA is filtering out. How can I filter out the second one? Please advise. Your help is greatly appreciated.

In the attachment is my response XML before and after the Request Filter is applied.

This is what I have in my Request filter.
def content = context.httpResponse.responseContent
log.info( content )
content = content.replaceAll( "<!\\[CDATA\\[", "" )
content = content.replaceAll( "]]>", "" )
content = content.replaceAll( "&lt;", "<" )
content = content.replaceAll( "&gt;", ">" )
content = content.replaceAll( "&quot;", "\\\"" )
content = content.replaceAll( "\\<\\?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"\\?\\>", "" )
log.info( content )
context.httpResponse.responseContent = content