Forum Discussion

jayrdi's avatar
jayrdi
Occasional Contributor
12 years ago

CDATA Event Handler

Some of the data I am trying to perform a Property-Transfer upon is nested inside CDATA tags. I have tried to work round this by adding an Event Handler to the Project (as per the guide at: http://www.soapui.org/Functional-Testing/working-with-cdata.html) but it doesn't work.

I have added the code:

def content = context.httpResponse.responseContent

content = content.replaceAll( "<!\\[CDATA\\[", "" )
content = content.replaceAll( "]]>", "" )

//log.info( content )

context.httpResponse.responseContent = content


to the Events tab in the Project View under the Event Handler name 'RequestFilter.afterRequest' which should apparently do the trick, but it doesn't. Can anyone think why this might not be working?

BTW I am using the Pro version but haven't been given a username and password yet.

Thanks for your help,

John

2 Replies

  • SiKing's avatar
    SiKing
    Community Expert
    For the Event, do you have anything in the "Traget" column?
    Could you post a sample of your (unmodified) RawResponse?
  • jayrdi's avatar
    jayrdi
    Occasional Contributor
    I've managed it now, but thanks for your reply!