cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove multimap tags xml

navepras
Explorer

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

<?xml version='1.0' encoding='UTF-8'?><multimap:Messages xmlns:multimap="http://sap.com/xi/XI/SplitAndMerge"><multimap:Message1><root><row>

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

<multimap:Messages xmlns:multimap="http://sap.com/xi/XI/SplitAndMerge"><multimap:Message1>

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

Accepted Solutions (1)

Accepted Solutions (1)

bhalchandraswcg
Contributor

Hi navepras,

You can skip removing the outer multimap:Messages or multipmap:Message tags completely.

Instead configure the XML to CSV Converter as

/multimap:Messages/multimap:Message1/root/row

You will have to declare the Namespace under Runtime Configuration => Namespace Mapping as

xmlns:multimap=http://sap.com/xi/XI/SplitAndMerge

Hope this helps,

Bala

navepras
Explorer
0 Kudos

Hi Bala

Thanks for your input

It is working

Regards

Naveen

Answers (1)

Answers (1)

Sriprasadsbhat
Active Contributor
0 Kudos

Hello Naveen,

Please provide your input data.

Regards,

Sriprasad Shivaram Bhat

navepras
Explorer
0 Kudos

Here is my XML Payload attached, I am calling data from SF which is 2 Parallel SF call and used gather to join those

If you want input data!! can you specify which input data you need ?callactivity-21.txt

Regards

Naveen