Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
dataleadge
Contributor
Contributor

Extracting data from XML file to MS SQL server in form of table.

Hello,

I'm new to talend and have been trying to transfer the xml data (attached file) to MS Sql.

After using the "tFileinputXml", "tmap_xml" and "tDBouput" component only one row of the file was transferred.

Please guide me to populate multiple rows iteratively else guide me on converting the xml file to excel file.

Thanks in advance 0683p000009MACn.png

 

The tags in the files are columns while the string between tags is the data to be transferred as rows. 

Labels (2)
1 Solution

Accepted Solutions
tnewbie
Creator II
Creator II

From the sample xml you shared, I think the issue is with xml file, as i don't see any nesting / looping of elements. Just for your better understanding I have added an element <COMPANY> with looping to ur xml ... please look into the below image

0683p000009M7HR.png

View solution in original post

7 Replies
manodwhb
Champion II
Champion II

@dataleadge ,can you post your job design,since you can check the get nodes in tfileinputxml to get loops.

iamabhishek
Creator III
Creator III

The XML file structure is not correct - in the sense that the fields VCHCOMPANYNAME, VCHVCHNUMBER etc.. which are repeating n times are not correctly put inside a loop or to put correctly not inside in nested elements. Hence the first lot in your case first 10 nodes are being captured and interpreted as the only row. You need the nodes to be in correct order - in the format of nested child elements.
Something like these - 

<root>
  <Participants>
    <Gender>Male</Gender>
    <Participation>
      <ParticipationType>Open</ParticipationType>
    </Participation>
  </Participants>
  <Participants>
    <Gender>Female</Gender>
    <Participation>
      <ParticipationType>Closed</ParticipationType>
    </Participation>
  </Participants>
</root>

 

dataleadge
Contributor
Contributor
Author

Hi,

 

I have attached and shared the job design files.


tfileinputxml.png
tfileinputxml2.png
Xpath.png
manodwhb
Champion II
Champion II

@dataleadge ,your loop xpath query is wrong ,please check

tnewbie
Creator II
Creator II

From the sample xml you shared, I think the issue is with xml file, as i don't see any nesting / looping of elements. Just for your better understanding I have added an element <COMPANY> with looping to ur xml ... please look into the below image

0683p000009M7HR.png

dataleadge
Contributor
Contributor
Author

It worked!!! 

Thanks a lot!

manodwhb
Champion II
Champion II

@dataleadge ,Please mark the solution the one which is helped you ,so that it would be useful to others.