Originally posted by: SystemAdmin
Scenario:
Input format - has a granular concept of Children and Kids.
The target format is less granular and are simple. Just got ListOfPeople.
We want to take all Children and Kids and map them into <People>
Input: <?xml version="1.0" encoding="UTF-8"?>
-
<Header>*
-
<id>1234</id>*
-
<name>CAT</name>*
-
*
-
<ListOfChild>*
-
<Child>*
-
<childName>jack</childName>*
-
<childAge>1</childAge>*
-
<childWeight>6</childWeight>*
-
</Child>*
-
<Child>*
-
<childName>john</childName>*
-
<childAge>2</childAge>*
-
<childWeight>8</childWeight>*
-
</Child>*
-
</ListOfChild>*
-
<ListOfKids>*
-
<Kids>*
-
<kidName>mike</kidName>*
-
<kidAge>11</kidAge>*
-
<kidWeight>80</kidWeight>*
-
</Kids>*
-
<Kids>*
-
<kidName>tom</kidName>*
-
<kidAge>12</kidAge>*
-
<kidWeight>90</kidWeight>*
Output: <?xml version="1.0" encoding="UTF-8"?>
-
<Header>*
-
<x>abc</x>*
-
<y>1234</y>*
-
*
-
<ListOfPeople>*
-
*
-
<People>*
-
<Name>jack</Name>*
-
<Age>1</Age>*
-
<Weight>6</Weight>*
-
</People>*
-
<People>*
-
<Name>jack</Name>*
-
<Age>1</Age>*
-
<Weight>6</Weight>*
-
</People>*
-
<People>*
-
<kidName>mike</kidName>*
-
<kidAge>11</kidAge>*
-
<kidWeight>80</kidWeight>*
-
</People>*
-
<People>*
-
<kidName>tom</kidName>*
-
<kidAge>12</kidAge>*
-
<kidWeight>90</kidWeight>*
-
</People>*
-
</ListOfPeople>*
Problem:
In WTX you have only one rule in the target type tree with the <People> element.
How can you tell it to take any Children or Kids and turn them into list of People.
Haven’t been able to find any merge in WTX, so looking for a pattern that merges XML node sets.
I tried creating three output cards & one input card. One for Header, second one for Children & third one for Kids. So this generates 3 output xmls.
How do i merge these three output Cards so that i will get one merged output XML?
Many thanks in advance.
#IBMSterlingTransformationExtender#IBM-Websphere-Transformation-Extender#DataExchange