How to Read, Validate and Insert an XML data into Mysql DB in Talend

One Star

How to Read, Validate and Insert an XML data into Mysql DB in Talend

Hi,
I will get an XML. I need to validate some fields of XML after that I need to Insert the data into DB. So please suggest me how to write the Talend Job for above operation..
Thanks in advance.
Moderator

Re: How to Read, Validate and Insert an XML data into Mysql DB in Talend

Hi,
Please make sure your XML file is well-formed and then you can use talend component tFileInputXML to retrieve your attribution into relational table.
For well-formed XML validation, here is a related article http://stackoverflow.com/questions/6362926/xml-syntax-validation-in-java, hope it will be useful for you.

Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: How to Read, Validate and Insert an XML data into Mysql DB in Talend

Hi,
I am inserting the below XML using the job.
<root>
<Department>
<deptId>D1</deptId>
<deptName>Mech</deptName>
<deptHeadName>Ashok kumar</deptHeadName>
</Department>
<Person>
<id>P1</id>
<lastName>kumar</lastName>
<firstName>Arif</firstName>
<firstName>Shyam</firstName>
<deatils>
<name>hnlk1</name>
<value>1678</value>
</deatils>
<deatils>
<name>hnlk2</name>
<value>1878</value>
</deatils>
<deptId></deptId>
</Person>
</root>
I am using attached job to insert the XML. If I want to change the values of some fields before insertion, which component I need to use?
Moderator

Re: How to Read, Validate and Insert an XML data into Mysql DB in Talend

Hi,
Maybe you are looking for this related forum Forum 31257.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.