cancel
Showing results for 
Search instead for 
Did you mean: 

How to Map the entire XML(Source XML) into one filed(Target Filed)

0 Kudos

Hi Folks,

Can anybody help me how to resolve the below requirement.

business requirement Is: in which client wants the complete input xml in one field at target side i.e., to return the input payload as an XML into a single field


for that we assumed XSLT Mapping is the correct. since i am new to XSLT mapping . i gone through the below URL also since i am unable to get the code.


below is the screen shot :


if some one provide me XSLT code for above requirement  that is a great help from your side.


Thanks in Advance

Hari

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Hari

I think you can achieve this with graphical mapping. Map your target filed with the root node of your input xml.

right click on the root node and select the option 'Return as xml'.

Thanks,

Indrajit

0 Kudos

Hi Indrajit,

Thanks for your reply..

Currently i am working for SAP PI 7.0 . i think this option won't be available in this version.

Kindly check and assist me.

Thanks in advance.

Hari

iaki_vila
Active Contributor
0 Kudos

Hi Hari,

I think with an UDF you can't do it. You should do it with Java mapping or XSLT. With XSL you can do the next example:

Source XML:


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

<test>

    <item1>1</item1>

    <item2>2</item2>

    <item3>3</item3>

</test>

XSL:


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

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="/">

        <xsl:element name="root" namespace="http://test">

            <xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>

            <xsl:copy-of select="/"/>

            <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>

        </xsl:element>

    </xsl:template>

</xsl:stylesheet>

Output XML:


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

<root xmlns="http://test"><![CDATA[<test><item1>1</item1><item2>2</item2><item3>3</item3></test>]]></root>

You can change the namespaces and the tags in the XSL that i provided the example. Pay attention to the xsl:element tag.

Hope this helps.

Regards.

Former Member
0 Kudos

Hi Hari

Check this. It may help you. Go for the java mapping

Whole Payload to a XML field - Process Integration - SCN Wiki

Thanks,

Indrajit

0 Kudos

Hi Indrajit,

Thank you sooo much.......much appreciated your response.

i will try with this.

Keep you updating the information.

best regards,

Hari

0 Kudos

Hi Inaki,

Much appreciated your quick response..

i will try with the mentioned code..

keep you updating the information..

Best regards,
Hari

iaki_vila
Active Contributor
0 Kudos

Hi Han,

Check  Jyothi Anagani blog


Regards.

0 Kudos

Hi inaki,

Thanks for your reply..

Currently i am working for SAP PI 7.0 . i think this option won't be available in this version.

Kindly check and assist me.

Former Member
0 Kudos

Hi,

If the source structure is not having so many fields then you can simply use CONCAT function or write simple UDF to generate single line output to target field.

Regards,

Sarvesh