Skip to Content
1
Jun 24, 2020 at 05:00 PM

How to remove multimap tags xml

1549 Views

Greetings,

I used Gather and merged two different payload which is of same XML format after Gather step i added XML to CSV converter(attached) to convert to CSV.

Since i have used MultiMapping i am getting payload as below

http://sap.com/xi/XI/SplitAndMerge"> >

Now i used a groovy script(given below) to ignore the below tags

http://sap.com/xi/XI/SplitAndMerge"> >

Groovy Script:

import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import java.io.*;

def Message processData(Message message) {
//get Body
	def body = message.getBody(java.lang.String) as String; 
//replaceMultimap tag
	body = body.replaceAll("<multimap:Messages xmlns:multimap=\"http://sap.com/xi/XI/SplitAndMerge\">", ""); 
//body = body.replaceAll("\"http://sap.com/xi/XI/SplitAndMerge\">", ""); 
	body = body.replaceAll("<multimap:Message1>",""); 
	body = body.replaceAll("</multimap:Message1>", "");
	body = body.replaceAll("</multimap:Messages>", "");
//set body
	message.setBody(body); 
	
	return message;
}

After adding i am getting below response

Unmarshalling XML Failed

Can anyone help me out to resolve this issue

Thanks in advancexmltocsv-1.png

Regards

Naveen

Attachments

xmltocsv-1.png (15.4 kB)