CSV to Multiple xml file conversion

One Star

CSV to Multiple xml file conversion

Hi,
I want to convert csv file to multiple xml file based on the record value, TAdvancedFileOutputXML component convert the entire csv to one xml.
How to create multiple xml based on values.
thanks a lot.
Community Manager

Re: CSV to Multiple xml file conversion

Hello
Can you show some input data and what are you expected result?
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: CSV to Multiple xml file conversion

Hi Shong,
i have a csv file with 4 columns named
Country city name age
Singapore shong test 23
Singapore shong test1 15
Hongkong xxxx velu 32
like this 1000 of rows.
I have to read this file and create a xml based on the country
those who all belong to same country and city(Singapore and shong ) are to be written in to one file.
then the next country to another file, and so on.
Thanks and Regards
Velu
Community Manager

Re: CSV to Multiple xml file conversion

Hello Velu
Here comes a Java example: (please see the screenshot)
tFileInputDelimited_1=tFileInputDelimited_3:

USA;New work;Elise;36
China;Shenzhen;shong;26
France;Paris;Plegall;27
Britain;London;Alice;23
France;Lyon;Alan;34
China;Beijing;TangYi;22
France;Nantes;Tom;44
China;Beijing;Yitong;20
France;Toulouse;CCarbone;30
Britain;London;Edward;23

tFileOutputDelimited_1=tFileInputDelimited_2;
Hope it helps you!
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: CSV to Multiple xml file conversion

Hi Shong,
i tried to create multiple XML file from DB, but end up with one file. when a particular field changed , need to create another file. Please help to create the same.thanks
One Star

Re: CSV to Multiple xml file conversion

Did you test shongs's solution?
Looks like this will work and fit you needs (creating different files based on a value in your row).
Setting the (dynamic) filename is made in picture "outschema2.png".
Bye
Volker
Not applicable

Re: CSV to Multiple xml file conversion

Thanks Shong.
I was looking for a comparable solution in Talend (for informatica , similar scenario) and this solution works perfectlt fine for me.