Extracting XML with a parent loop which has multiple child loops

One Star

Extracting XML with a parent loop which has multiple child loops

Hi All,
I am trying to extract data from xml file (actually the data is returned by a web service call using tRESTClient).
This particular response/XML file has a parent loop and each parent has 4 or 5 child loops.
I tried parsing this using tExtractXMLField, tXMLMap, tFileInputXML but not able to parse it correctly. I found each of the component has their own limitation while reading and writing the data, hence none of those is able to parse this XML or even combination of those components also couldn't do it.
Can anybody please help me with this? 
Here's the XML:
<set>
   <ActivityInstance>
       <processUUID>
           <value>DiscountApproval--1.0</value>
       </processUUID>
       <instanceUUID>
           <value>DiscountApproval--1.0--2</value>
       </instanceUUID>
       <rootInstanceUUID>
           <value>DiscountApproval--1.0--2</value>
       </rootInstanceUUID>
       <uuid>
           <value>DiscountApproval--1.0--2--Approve_Deny--it1--mainActivityInstance--noLoop</value>
       </uuid>
       <iterationId>it1</iterationId>
       <activityInstanceId>mainActivityInstance</activityInstanceId>
       <loopId>noLoop</loopId>
       <state>FINISHED</state>
       <lastUpdate>1425015121574</lastUpdate>
       <label>Approve/Deny</label>
       <description></description>
       <name>Approve_Deny</name>
       <startedDate>1425015121569</startedDate>
       <endedDate>1425015121576</endedDate>
       <readyDate>1425015104921</readyDate>
       <endedBy>Mymanager</endedBy>
       <startedBy>Mymanager</startedBy>
       <activityDefinitionUUID>
           <value>DiscountApproval--1.0--Approve_Deny</value>
       </activityDefinitionUUID>
       <expectedEndDate>0</expectedEndDate>
       <priority>0</priority>
       <type>Human</type>
       <human>true</human>
       <stateUpdates>
           <StateUpdate>
               <dbid>0</dbid>
               <date>1425015104921</date>
               <state>READY</state>
               <updateUserId>SYSTEM</updateUserId>
               <initialState>READY</initialState>
           </StateUpdate>
           <StateUpdate>
               <dbid>0</dbid>
               <date>1425015121569</date>
               <state>EXECUTING</state>
               <updateUserId>Mymanager</updateUserId>
               <initialState>READY</initialState>
           </StateUpdate>
           <StateUpdate>
               <dbid>0</dbid>
               <date>1425015121576</date>
               <state>FINISHED</state>
               <updateUserId>Mymanager</updateUserId>
               <initialState>EXECUTING</initialState>
           </StateUpdate>
       </stateUpdates>
       <clientVariables>
           <entry>
               <string>managerApproval</string>
               <null/>
           </entry>
       </clientVariables>
       <variableUpdates>
           <org.ow2.bonita.facade.runtime.impl.VariableUpdateImpl>
               <date>1425015116320</date>
               <userId>Mymanager</userId>
               <name>managerApproval</name>
               <clientVariable class="string">true</clientVariable>
           </org.ow2.bonita.facade.runtime.impl.VariableUpdateImpl>
       </variableUpdates>
       <assignUpdates>
           <AssignUpdate>
               <dbid>0</dbid>
               <date>1425015104949</date>
               <state>READY</state>
               <updateUserId>SYSTEM</updateUserId>
               <candidates>
                   <string>Mymanager</string>
               </candidates>
           </AssignUpdate>
       </assignUpdates>
       <candidates>
           <string>Mymanager</string>
       </candidates>
   </ActivityInstance>
   <ActivityInstance>
       <processUUID>
           <value>DiscountApproval--1.0</value>
       </processUUID>
       <instanceUUID>
           <value>DiscountApproval--1.0--2</value>
       </instanceUUID>
       <rootInstanceUUID>
           <value>DiscountApproval--1.0--2</value>
       </rootInstanceUUID>
       <uuid>
           <value>DiscountApproval--1.0--2--Approved--it1--mainActivityInstance--noLoop</value>
       </uuid>
       <iterationId>it1</iterationId>
       <activityInstanceId>mainActivityInstance</activityInstanceId>
       <loopId>noLoop</loopId>
       <state>READY</state>
       <lastUpdate>1425015126468</lastUpdate>
       <label>Approved</label>
       <description></description>
       <name>Approved</name>
       <startedDate>0</startedDate>
       <endedDate>0</endedDate>
       <readyDate>1425015121643</readyDate>
       <activityDefinitionUUID>
           <value>DiscountApproval--1.0--Approved</value>
       </activityDefinitionUUID>
       <expectedEndDate>0</expectedEndDate>
       <priority>0</priority>
       <type>Human</type>
       <human>true</human>
       <stateUpdates>
           <StateUpdate>
               <dbid>0</dbid>
               <date>1425015121643</date>
               <state>READY</state>
               <updateUserId>SYSTEM</updateUserId>
               <initialState>READY</initialState>
           </StateUpdate>
       </stateUpdates>
       <clientVariables/>
       <variableUpdates/>
       <assignUpdates>
           <AssignUpdate>
               <dbid>0</dbid>
               <date>1425015126470</date>
               <state>READY</state>
               <updateUserId>SYSTEM</updateUserId>
               <candidates>
                   <string>Myself</string>
               </candidates>
           </AssignUpdate>
       </assignUpdates>
       <candidates>
           <string>Myself</string>
       </candidates>
   </ActivityInstance>
   <ActivityInstance>
       <processUUID>
           <value>DiscountApproval--1.0</value>
       </processUUID>
       <instanceUUID>
           <value>DiscountApproval--1.0--2</value>
       </instanceUUID>
       <rootInstanceUUID>
           <value>DiscountApproval--1.0--2</value>
       </rootInstanceUUID>
       <uuid>
           <value>DiscountApproval--1.0--2--Enter_Discount--it1--mainActivityInstance--noLoop</value>
       </uuid>
       <iterationId>it1</iterationId>
       <activityInstanceId>mainActivityInstance</activityInstanceId>
       <loopId>noLoop</loopId>
       <state>FINISHED</state>
       <lastUpdate>1425015104800</lastUpdate>
       <label>Enter Discount</label>
       <description></description>
       <name>Enter_Discount</name>
       <startedDate>1425015104793</startedDate>
       <endedDate>1425015104801</endedDate>
       <readyDate>1425015074730</readyDate>
       <endedBy>Myself</endedBy>
       <startedBy>Myself</startedBy>
       <activityDefinitionUUID>
           <value>DiscountApproval--1.0--Enter_Discount</value>
       </activityDefinitionUUID>
       <expectedEndDate>0</expectedEndDate>
       <priority>0</priority>
       <type>Human</type>
       <human>true</human>
       <stateUpdates>
           <StateUpdate>
               <dbid>0</dbid>
               <date>1425015074730</date>
               <state>READY</state>
               <updateUserId>SYSTEM</updateUserId>
               <initialState>READY</initialState>
           </StateUpdate>
           <StateUpdate>
               <dbid>0</dbid>
               <date>1425015104793</date>
               <state>EXECUTING</state>
               <updateUserId>Myself</updateUserId>
               <initialState>READY</initialState>
           </StateUpdate>
           <StateUpdate>
               <dbid>0</dbid>
               <date>1425015104801</date>
               <state>FINISHED</state>
               <updateUserId>Myself</updateUserId>
               <initialState>EXECUTING</initialState>
           </StateUpdate>
       </stateUpdates>
       <clientVariables>
           <entry>
               <string>selectedProduct</string>
               <null/>
           </entry>
           <entry>
               <string>customer</string>
               <null/>
           </entry>
           <entry>
               <string>custsFromDb</string>
               <null/>
           </entry>
           <entry>
               <string>products</string>
               <string></string>
           </entry>
       </clientVariables>
       <variableUpdates>
           <org.ow2.bonita.facade.runtime.impl.VariableUpdateImpl>
               <date>1425015098769</date>
               <userId>Myself</userId>
               <name>selectedProduct</name>
               <clientVariable class="string">Product2</clientVariable>
           </org.ow2.bonita.facade.runtime.impl.VariableUpdateImpl>
           <org.ow2.bonita.facade.runtime.impl.VariableUpdateImpl>
               <date>1425015098772</date>
               <userId>Myself</userId>
               <name>customer</name>
               <clientVariable class="string">SAP_Client</clientVariable>
           </org.ow2.bonita.facade.runtime.impl.VariableUpdateImpl>
       </variableUpdates>
       <assignUpdates>
           <AssignUpdate>
               <dbid>0</dbid>
               <date>1425015079526</date>
               <state>READY</state>
               <updateUserId>SYSTEM</updateUserId>
               <candidates>
                   <string>Myself</string>
               </candidates>
           </AssignUpdate>
       </assignUpdates>
       <candidates>
           <string>Myself</string>
       </candidates>
   </ActivityInstance>
</set>

Any help on this will really be appreciated.
Thanks a lot in advance.
Five Stars

Re: Extracting XML with a parent loop which has multiple child loops

check this post which smiler to your scenario. 
read-xml-with-nested-loops
One Star

Re: Extracting XML with a parent loop which has multiple child loops

Thanks.
But we're not looking to break one row XML data into multiple rows/schemas.
We need to parse that XML in one data row i.e. one schema. So that we can play around with this one row schema with our needs.
And how do we convert those parent loops and multiple child nested loops to Json? 
One Star

Re: Extracting XML with a parent loop which has multiple child loops

Can anyone write one demo job to read that XML to row schema and then convert it into json? 
It will be of great help. Thanks a ton in advance.
One Star

Re: Extracting XML with a parent loop which has multiple child loops

Anyone?
One Star

Re: Extracting XML with a parent loop which has multiple child loops

Someone?
One Star

Re: Extracting XML with a parent loop which has multiple child loops

No one?
Five Stars

Re: Extracting XML with a parent loop which has multiple child loops

Can you show us what output are you looking?  also show us what are the ways you tried, and output you got, it will help us too. 
One Star

Re: Extracting XML with a parent loop which has multiple child loops

I want the XML from my first post, as a JSON output. 
I tried various components like tXMLMap, tExtractXML, tExctractMSXml, tWriteJson. All has their advantages and limitations. I can read the XML fine but I am not able to convert it into JSON due to the limitation of tWriteJson which allows only one loop.
Also I've don't have good knowledge on how to use Data Mappings (I do have Enterprise Version), still I managed to play it around and create my own tMyMap (custom map like tMap, tHMap, tXMLMap). But even in that case, I just don't know how would I convert my data into JSON!!
I am simply stuck due to various limitations of different components and not able to find my way out of this.
If experts don't have answers to above questions then One final question for you guys: IS THIS EVEN POSSIBLE TO DO IN TALEND? XML to JSON, that's it!!!!! Or we just have to use some third party library to create JSON using tJava, tJavaFlex, etc?
One Star

Re: Extracting XML with a parent loop which has multiple child loops

Folks?