You are not logged in.
Announcement
Unanswered posts
|
Pages: 1
Hi: I am trying to map an xml document to table columns using tFileinputXML but stuck how to loop through elements that can be present more than once. E.g see the xml data below, not only I want to loop through all the elements, but I also would like to create a Many to One relationship on the basis of looped element to the relational database. Any help will be appreciated.
<entry dataset="Swiss-Prot" created="1986-07-21" modified="2009-09-01" version="151">
<accession>P00533</accession>
<accession>O00688</accession>
<accession>O00732</accession>
<accession>P06268</accession>
<accession>Q14225</accession>
<accession>Q68GS5</accession>
<accession>Q92795</accession>
<accession>Q9BZS2</accession>
<accession>Q9GZX1</accession>
<accession>Q9H2C9</accession>
<accession>Q9H3C9</accession>
<accession>Q9UMD7</accession>
<accession>Q9UMD8</accession>
<accession>Q9UMG5</accession>
<name>EGFR_HUMAN</name>
</entry>
Thanks,
Rashid.
Hello Rashid
Can you give us an example to expalin your request?
Best regards
shong
Offline
Shong you can pick any example where you have one parent element tag with 1 to many child elements, some thing like the one I posted previously. Ok let me create an example and try to explain it to you. Let’s say we have a department named “Sales” with lot of employees and we want to store element department in parent table and all the sub employees in the child table. See the xml below
<root>
<department id=1 name=”Sales”>
<employee> John </ employee >
<employee> Alex </ employee >
<employee> Sharon </ employee >
</department>
</root>
Now let’s say I have two tables Department and Employees and I want to store department "sales" on Department table and all the employees in employee table with department id 1 as the foreign key.
Hello
You can extract the id,name and employee from xml file, then generate two table on tMap. see my screenshots.
Best regards
shong
Offline
Hi,
I've exact the same problem, I need to import a multi level xml with nested loops?
Example:
<ZPM_EQUIPMENT_EXPORT>
<EQUI>
<EQUNR>000000000010032036</EQUNR>
<AEDAT>2009-07-07</AEDAT>
</EQUI>
<CLOBJDAT>
<CLOBJDAT>
<TABIX>1</TABIX>
<ATFLV>9.9E1</ATFLV>
<ATNAM>ZZ_IT_KOSTENGRUPPE</ATNAM>
</CLOBJDAT>
<CLOBJDAT>
<TABIX>2</TABIX>
<ATFLV>0</ATFLV>
<ATNAM>ZZ_ANLAGENHAUPTNUMMER</ATNAM>
</CLOBJDAT>
<CLOBJDAT>
</ZPM_EQUIPMENT_EXPORT>
regards
Meex
Thanks Shong that was exactly I was looking for.
Regards,
RJ.
but this doesn't work for my case!
ok, found the solution: http://www.talendforge.org/forum/viewtopic.php?id=6016
Pages: 1