Read XML having Multiple Nested Loops in Different Parent Node

Four Stars

Read XML having Multiple Nested Loops in Different Parent Node

We need to process a xml with data such that it has multiple values in two child nodes.
When i loop it on DesignatedCountryCode it doesnot read multiple ClassNumber values and when i loop it on ClassNumber it doesnot read data for multiple DesignatedCountryCode. 
 Below is the sample data:
<TradeMark>
 <TradeMarkIdentifier>273985233</TradeMarkIdentifier>
 <DesignatedCountryDetails>
   <DesignatedCountry>
  <DesignatedCountryCode>SG</DesignatedCountryCode>
  <DesignatedUnderCode>Protocol</DesignatedUnderCode>
   </DesignatedCountry>
    <DesignatedCountry>
<DesignatedCountryCode>AM</DesignatedCountryCode>
<DesignatedUnderCode>Protocol</DesignatedUnderCode>
   </DesignatedCountry>
 </DesignatedCountryDetails>
 <GoodsServicesDetails>
   <GoodsServices>
<ClassificationKindCode>Nice</ClassificationKindCode>
<ClassDescriptionDetails>
  <ClassDescription>
    <ClassNumber>35</ClassNumber>
    <GoodsServicesDescription languageCode="en" hashKey="GOMLWgjSHm95KAe3qGkqcILQ4Zo=">Advertising; business management; business administration; </GoodsServicesDescription>
  </ClassDescription>
  <ClassDescription>
    <ClassNumber>36</ClassNumber>
    <GoodsServicesDescription languageCode="en" hashKey="eBoBcVWuav1yLPZk3Q78xPsnR/k=">Financial affairs; real estate affairs; .</GoodsServicesDescription>
  </ClassDescription>
</ClassDescriptionDetails>
   </GoodsServices>
 </GoodsServicesDetails>
</TradeMark>
Please help.
Thanks,
Saurabh.
Six Stars

Re: Read XML having Multiple Nested Loops in Different Parent Node

Hi Shukla,
If you are using Talend Enterprise Edition version more than 5.4.1. You will have Talend Data Mapper, which is capable of processing complex xml files. 
If you are using open studio or older version of Talend then we will not have TDM.  Even though older versions have tfileinputxml component, this can n't help for complex xml files.
Thanks,
L Raghunath.
Raghunath Lingutla
Five Stars

Re: Read XML having Multiple Nested Loops in Different Parent Node

you can do it using following job design.
tFileInputXMl---tXMLMap---(out one for first loop)
                          \(output two for second loop segment)
Now follow the instructions from read xml with nested loops.
Four Stars

Re: Read XML having Multiple Nested Loops in Different Parent Node

Hi Umesh,
Thanks for the reply , i am doing this on Talend sandbox and did what you suggested. But problem with above solution is that ultimately i want to make a list of the multiple element and load it as one row for every id. If i divide it in multiple outputs i am not able to join the two flows after aggregating. My flow looks like this:
                                      --> taggregator1 --> tlogrow1
txmlinput --> txmlmap --> 
                                     --> taggregator2 -->tlogrow2
I want to join the data of flow1 and flow2 and load it into cassandra.
Please suggest.
Thanks,
Saurabh.
Five Stars

Re: Read XML having Multiple Nested Loops in Different Parent Node

for that you need to store your data either in file/db or tHashXXXXX components and then read it again for merge it. 
after tAggregate ---tFileoutput. do it for both the flow. 

use tFileinput with same schema which was used in last tFileOutput component. 
use merge or tMap/tJon to make it one row. 
tFileinput-----tMap-----main---youroutput. 
tFileinput -----/
Create temporary id using numeric.sequence and share same id with both the flow then use this column for joining.
Four Stars

Re: Read XML having Multiple Nested Loops in Different Parent Node

Yes but this seems a complex solution in case of 70-75 multi value fields.I will need to write it in 75 temp files and process it in next flow. This inturn will have performance impact as well.. !!
Thanks a lot for suggesting this and replying on my post!!
-Saurabh.

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog

Talend Integration with Databricks

Take a look at this video about Talend Integration with Databricks

Watch Now