Forum Discussion

shaibayan's avatar
shaibayan
Occasional Visitor
7 years ago

Converting XMLs using Groovy Script

Hello All,

 

I have an XML structure as below as part of a mapping tool step.

 

<?xml version="1.0" encoding="UTF-8"?>

<multimap:Messages xmlns:multimap="http://abc.com/z/Z/SplitAndMerge">

<multimap:Message1>

<Response>

<Employment><status>OK</status></Employment>

</Responses>

<Responses>

<Term><status>OK</status></Term>

</Responses>

</multimap:Message1>

</multimap:Messages>

 

I need to separate each of the Response into separate Message numbers as below.

 

<?xml version="1.0" encoding="UTF-8"?>

<multimap:Messages xmlns:multimap="http://abc.com/z/Z/SplitAndMerge">

<multimap:Message1>

<Response>

<Employment><status>OK</status></Employment>

</Responses>

</multimap:Message1>

<multimap:Message2>

<Responses>

<Term><status>OK</status></Term>

</Responses>

</multimap:Message2>

</multimap:Messages>

 

Is there a way to achieve this using groovy?

 

Thanks,

Shai