XML input to tExtractXMLField and customize the output records

Highlighted
Five Stars

XML input to tExtractXMLField and customize the output records

I am new to talend and putting lot of efforts to be proficient. I will explain my scenario with an example:
1. I am extracting data from a DB2 table and this table has 4 columns:

Column 3 XML_DATA

2. Finally, loading all the data into Hive table on the HDFS. Hive table format is as follows:

CREATE EXTERNAL TABLE IF NOT EXISTS SampleTable
(
Id Int,
IDB_Id String,
occ String
Status String,
Original_Retail String,
Id1 String,
occ1 String,
New_Item Array<Struct<Type: String,occ2: String,Code: String,Vendor_Description: String,Family: String,Style_Diff_Id: String,IDB_Id1: String>>,
Vendor_Style: String
)

3. "Column 3 XML_DATA" column is given as input to tExtractXMLField component. I was able to loop thru the XML to generate the output file in the following format (Multiple records for column 3 XML_DATA) :

273586991;0438554206218;331350659;A;16.0;3201550;331350984;SIZE;331350986;10880;XSmall;;;;3622223
273586991;0438554206218;331350659;A;16.0;3201550;331350984;SIZE;331351094;10965;Small;;;;3622223
273586991;0438554206218;331350659;A;16.0;3201550;331350984;SIZE;331351240;10970;Medium;;;;3622223
273586991;0438554206218;331350659;A;16.0;3201550;331350984;SIZE;331351387;10975;Large;;;;3622223
273586991;0438554206218;331350659;A;16.0;3201550;331350984;SIZE;331351492;10980;XLarge;;;;3622223
273586991;0438554206218;331350659;A;16.0;3201550;331350984;SIZE;331351679;10985;XXLarge;;;;3622223
273586991;0438554206218;331350659;A;16.0;3201550;331350985;COLOR;331350987;489;AQUA NAVY;;273586991.489;0438554206201;3622223

 

Questions:

I would like to merge all the above records in the following format which is the structure of the Hive table. How do i do that?

273586991;0438554206218;331350659;A;16.0;3201550;331350984;SIZE|331350986|10880|XSmall|||:SIZE|331351094|10965|Small|||:SIZE|331351240|10970|Medium|||:SIZE|331351387|10975|Large|||:SIZE|331351492|10980|XLarge|||:SIZE|331351679|10985|XXLarge|||:COLOR|331350987|489|AQUA NAVY||273586991.489|0438554206201;3622223

Sample XML file is attached.
FileXML is attached.

Thank you and appreciate your response.

Moderator

Re: XML input to tExtractXMLField and customize the output records

Hello,

You want all of your outputs from tExtractXMLField to be merged together? In the form of a single column of output data?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

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