Skip to Content
0
Former Member
Jan 26, 2018 at 09:08 AM

Adapter module for copying xml fields to another node

72 Views Last edit Jan 26, 2018 at 09:38 AM 6 rev

Hi Experts,

I have requirement to copy fields in xml to another node. We don't have XSD and much mapping to do. So decided to use adapter module. Just need to add <Batch> and </Batch> tags and copy DATA/FIELD4 to DATA1/FIELD2(repeat this step as many times we have DATA node). I managed to add <Batch> but not sure, how to copy fields. Any help will be really appreciated.

Input xml:

<MT_ROOT>

<DATA>

<FIELD1>value1</FIELD1>

<FIELD2>value2</FIELD2>

<FIELD3>value3</FIELD3>

<DATA1>

<FIELD1>value4</FIELD1>

</DATA1>

<FIELD4>value5</FIELD4>

</DATA>

<DATA>

<FIELD1>value1</FIELD1>

<FIELD2>value2</FIELD2>

<FIELD3>value3</FIELD3>

<DATA1>

<FIELD1>value4<FIELD1>

</DATA1>

<FIELD4>value5<FIELD4>

</DATA>

</MT_ROOT>

Expected xml:

<Batch>

<MT_ROOT>

<DATA>

<FIELD1>value1</FIELD1>

<FIELD2>value2</FIELD2>

<FIELD3>value3</FIELD3>

<DATA1>

<FIELD1>value4</FIELD1>

<FIELD2>value5</FIELD2>

</DATA1>

<FIELD4>value5<FIELD4>

</DATA>

<DATA>

<FIELD1>value1</FIELD1>

<FIELD2>value2</FIELD2>

<FIELD3>value3</FIELD3>

<FIELD4>value4</FIELD4>

<DATA1>

<FIELD1>value4</FIELD1>

<FIELD2>value5</FIELD2>

</DATA1>

<FIELD4>value5<FIELD4>

</DATA>

</MT_ROOT>

</Batch>

Thanks

Attachments

module.jpg (53.6 kB)