[resolved] Convert EXCEL into XML while re-organize similar items together

One Star

[resolved] Convert EXCEL into XML while re-organize similar items together

Hi everyone,
I need help on the following. Can you please tell me if i can do the following transformation?
Convert my excel file into an XML file while re-organizing and re-structure similar items together. (Hope my example is good)
Excel file:

A B C D E
1 Make Series Engine Chassis Owner
-----------------------------------------------------------------
2 BMW 1 1.5 Hatchback Smith John
3 BMW 3 1.5 Sedan Foster Carl
4 Mercedes SLK 3.0 Coupe Ulrich Stan
5 Audi A6 1.6 Sedan Barnes Steve
6 Audi A3 1.6 Sedan Anderson Kevin
7 BMW 1 1.5 Hatchback Hart Bill

The XML file:
<type version="1.0">
<value label="BMW">
<value label="1">
<value label="1.5">
<value label="Hatchback">
<value label="Smith John"/>
<value label="Hart Bill"/>
</value>
</value>
</value>
<value label="3">
<value label="1.5">
<value label="Sedan">
<value label="Foster Carl"/>
</value>
</value>
</value>
</value>
<value label="Audi">
<value label="A6">
<value label="1.6">
<value label="Sedan">
<value label="Barnes Steve"/>
</value>
</value>
</value>
<value label="A3">
<value label="1.6">
<value label="Sedan">
<value label="Anderson Kevin"/>
</value>
</value>
</value>
</value>
<value label="Mercedes">
<value label="SLK">
<value label="3.0">
<value label="Coupe">
<value label="Ulrich Stan"/>
</value>
</value>
</value>
</value>
</type>
Rgds,
B

Accepted Solutions
Community Manager

Re: [resolved] Convert EXCEL into XML while re-organize similar items together

Hello
Yes, it is possible, please see my demo job.
in.csv:

BMW;1;1.5;Hatchback;Smith John
BMW;3;1.5;Sedan;Foster Carl
Mercedes;SLK;3.0;Coupe;Ulrich Stan
Audi;A6;1.6;Sedan;Barnes Steve
Audi;A3;1.6;Sedan;Anderson Kevin
BMW;1;1.5;Hatchback;Hart Bill

out.xml:
<?xml version="1.0" encoding="ISO-8859-15"?>
<type version="1.0">
<value label="Audi">
<value label="A3">
<value label="1.6">
<value label="Sedan">
<value label="Anderson Kevin"/>
</value>
</value>
</value>
<value label="A6">
<value label="1.6">
<value label="Sedan">
<value label="Barnes Steve"/>
</value>
</value>
</value>
</value>
<value label="BMW">
<value label="1">
<value label="1.5">
<value label="Hatchback">
<value label="Smith John"/>
<value label="Hart Bill"/>
</value>
</value>
</value>
<value label="3">
<value label="1.5">
<value label="Sedan">
<value label="Foster Carl"/>
</value>
</value>
</value>
</value>
<value label="Mercedes">
<value label="SLK">
<value label="3.0">
<value label="Coupe">
<value label="Ulrich Stan"/>
</value>
</value>
</value>
</value>
</type>

Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

View solution in original post


All Replies
Community Manager

Re: [resolved] Convert EXCEL into XML while re-organize similar items together

Hello
Yes, it is possible, please see my demo job.
in.csv:

BMW;1;1.5;Hatchback;Smith John
BMW;3;1.5;Sedan;Foster Carl
Mercedes;SLK;3.0;Coupe;Ulrich Stan
Audi;A6;1.6;Sedan;Barnes Steve
Audi;A3;1.6;Sedan;Anderson Kevin
BMW;1;1.5;Hatchback;Hart Bill

out.xml:
<?xml version="1.0" encoding="ISO-8859-15"?>
<type version="1.0">
<value label="Audi">
<value label="A3">
<value label="1.6">
<value label="Sedan">
<value label="Anderson Kevin"/>
</value>
</value>
</value>
<value label="A6">
<value label="1.6">
<value label="Sedan">
<value label="Barnes Steve"/>
</value>
</value>
</value>
</value>
<value label="BMW">
<value label="1">
<value label="1.5">
<value label="Hatchback">
<value label="Smith John"/>
<value label="Hart Bill"/>
</value>
</value>
</value>
<value label="3">
<value label="1.5">
<value label="Sedan">
<value label="Foster Carl"/>
</value>
</value>
</value>
</value>
<value label="Mercedes">
<value label="SLK">
<value label="3.0">
<value label="Coupe">
<value label="Ulrich Stan"/>
</value>
</value>
</value>
</value>
</type>

Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

View solution in original post

One Star

Re: [resolved] Convert EXCEL into XML while re-organize similar items together

Thanks
You and Talend are great
B.
One Star

Re: [resolved] Convert EXCEL into XML while re-organize similar items together

i am not able to create group element and group in rest of the fields can some one guide me
Community Manager

Re: [resolved] Convert EXCEL into XML while re-organize similar items together

i am not able to create group element and group in rest of the fields can some one guide me

You must create a loop element first, and then create a group element.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Convert EXCEL into XML while re-organize similar items together

HI guy..
please help me..
I want to convert my XML file into Excel without using any third party software, can it be possible using TALEND

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

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog