cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting XML document with CDATA tag passed as a String inside another XML document

former_member670153
Discoverer
0 Kudos
1,606

Hello SAP gurus,

I have a requirement; we are receiving a mail attachment which contains an XML document. Inside the XML document, there is a field which contains a string data. The data is another XML document with CDATA tags. I need to extract the XML with CDATA tags and map it with INVOIC IDoc type.

capture.png

I want to know the approach for this requirement. I tried XSLT mapping but not able to figure out how to extract the data into a XML structure.

Thank you,

Kunal Karmakar

Accepted Solutions (1)

Accepted Solutions (1)

r_herrmann
Active Contributor

Hi Kunal,

I would do it in two steps/mappings. (Chained together in one Operation Mapping.)

  • First write a small Java mapping which reads the incoming payload and unpacks the CData element. There result of this first mapping should be the complete XML from the CData tag. You could use unwrap the CData as shown here: https://stackoverflow.com/a/8489223/251719
  • Then add a graphical mapping which has on source side the definition of the XML which is wrapped in the CData element and on target side the IDOC definition.

Of course you could do it all in one Java mapping, but thus you coudn't leverage from the advantages/easeness of the graphical mapping. That's why I would do it in two steps.

former_member670153
Discoverer

Hello Raffael,

Thank you for your answer.

I have worked it out now.

Much appreciated!

Answers (0)