0
votes

I have an XML input,

        <MilitaryHistory>
            <Branch>AString</Branch>
            <Branch>BString</Branch>
        </MilitaryHistory>

And it should be converted to

        <MilitaryHistory>
            <military>
                <Branch>AString</Branch>
            </military>
            <military>
               <Branch>BString</Branch>
            </military>
        </MilitaryHistory>

I don't see any option to map these, when I do the normal mapping from parent level. Target is disabled for military element.

I dragged from source military to military in the target and changed the below in script.

output.__id = input.__id;
output.__parent_id = input.__parent_id;

to

output.__id = input.__id;
output.__parent_id = input.__id;

I get below output,

         <MilitaryHistory>
            <military>
                <Branch>AString,Bstring</Branch>
            </military>
        </MilitaryHistory>

I tried creating rule under MilitaryHistory tag, but no luck

1

1 Answers

0
votes

You can use an XSLT to get the expected output... use XSLT Transformer of Mule and use XSLT script in it to get your expected output