cancel
Showing results for 
Search instead for 
Did you mean: 

Split XML fields into target XML file.

former_member233212
Participant
0 Kudos

Dear experts,

My scenario is to split the XML fields of input payload to output payload.

here in input payload I've all the fields under one tag where as for output we need to split each group into another tag.

This below structure is just to understand the requirement:

<Input>
a

b

c

d

a

b

c

d
</input>


<Output>
<chunck>
a

b

c

d

</chunck>

<chunck>

a

a

c

d

</chunck>

</Output>

FYI:

When I try with normal mapping I get the output as below.
<Output>

<chunck>

a

a

b

b

c

c

d

d

</chunck>

</Output>

Please help me to resolve this.

I also tried finding the java code online to do this splitting.

Regards,

Vidhya Nizamkar

Accepted Solutions (1)

Accepted Solutions (1)

former_member190293
Active Contributor
0 Kudos

Hi Vidhya!

Regards, Evgeniy.

former_member233212
Participant
0 Kudos

Dear Evgeniy,

Thanks a lot. It worked 🙂

Regards,

Vidhya Nizamkar

Answers (1)

Answers (1)

former_member190293
Active Contributor
0 Kudos

Hi Vidhya!

Just map each of your source fields to according field inside <chunk> element of target structure and use SplitByValue function to split your source queues.

Regards, Evgeniy.

former_member233212
Participant
0 Kudos

Hi Evgeniy,

Thanks for replying.

I tried the same by adding the splitbyvalue function but I'm receiving all fields in sequence.

Like all the <a> tag will be displayed first.
then all <b> tags.
then all <c> tags.

Let me give this example.

Input will be as below.
<input>

<a>hi</a><b>there</b>

<a>dsg</a><b>cxvzv</b>

<a>hi</a> <b>xzcxvz</b>

</input>

Output should be as below.

<input>

<subtag>

<a>hi</a><b>there</b>

</subtag>

<subtag>

<a>dsg</a><b>cxvzv</b>

</subtag>

<subtag>

<a>hi</a><b>xzcxvz</b>

</subtag>

</input>

If I use split by value my output is as below.

<input>

<subtag>

<a>hi</a><a>dsg</a><a>hi</a>

<b>there</b>><b>cxvzv</b><b>xzcxvz</b>

</subtag>

</input>

Regards,

Vidhya Nizamkar