One Star

XML metadata with many tags with the same name

Hi,
I was wondering what would be the best way to create metadata of an XML file with this format:
<?xml version="1.0" encoding="utf-8"?>
<django-objects version="1.0">
<object pk="8" model="auth.user">
<field type="CharField" name="username">jd</field>
<field type="CharField" name="first_name">John</field>
<field type="CharField" name="last_name">Doe</field>
<field type="CharField" name="email">bla@bla.com</field>
</object>
<object pk="2102684" model="auth.user">
<field type="CharField" name="username">kp</field>
<field type="CharField" name="first_name">Karl</field>
<field type="CharField" name="last_name">Row</field>
<field type="CharField" name="email">karl@test.com</field>
</object>
.... etc
</django-objects>
The problem here is that the <field> tag repeats multiple times (instead of having a separate <username>, <first_name>, etc tag), which causes the default metadata mapping to only return the first occurance (username).
How can I best map this kind of data?
Thanks
koen
2 REPLIES
Community Manager

Re: XML metadata with many tags with the same name

Hi
I have replied the same question in topic:
http://www.talendforge.org/forum/viewtopic.php?id=27179
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: XML metadata with many tags with the same name

Thanks. I ended up looping over de "object" tag and used the "@field" for the columns which worked fine. Thank you for taking the time to read. Talend is awesome, it got the job done perfectly.