Automated way to convert XML files to SQL database? [closed] Automated way to convert XML files to SQL database? [closed] xml xml

Automated way to convert XML files to SQL database? [closed]


For Mysql please see the LOAD XML SyntaxDocs.

It should work without any additional XML transformation for the XML you've provided, just specify the format and define the table inside the database firsthand with matching column names:

LOAD XML LOCAL INFILE 'table1.xml'    INTO TABLE table1    ROWS IDENTIFIED BY '<table1>';

There is also a related question:

For Postgresql I do not know.


There is a project on CodeProject that makes it simple to convert an XML file to SQL Script. It uses XSLT. You could probably modify it to generate the DDL too.

And See this question too : Generating SQL using XML and XSLT


If there is XML file with 2 different tables then will:

LOAD XML LOCAL INFILE 'table1.xml' INTO TABLE table1 LOAD XML LOCAL INFILE 'table1.xml' INTO TABLE table2

work