Skip to Content

Split XML fields into target XML file.

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Dec 28, 2016 at 01:24 AM

    Hi Vidhya!

    Regards, Evgeniy.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 27, 2016 at 07:05 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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