Automated mode to convert XML files to SQL database?
source link: https://www.codesd.com/item/automated-mode-to-convert-xml-files-to-sql-database.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Automated mode to convert XML files to SQL database?
We have a bunch of XML files, following a schema which is essentially a serialised database form:
<table1>
<column1>value</column1>
<column2>value</column2>
</table1>
<table1>
<column1>another value</column1>
<column2>another value</column2>
</table1>
...
Is there a really easy way to turn that into an SQL database? Obviously I can manually construct the schema, identify all tables, fields etc, and then write a script to import it. I just wonder if there are any tools that could automate some or all of that process?
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:
- How to import XMl file into MySQL database table using XML_LOAD(); function
For Postgresql I do not know.
Related Articles
Convert xml file to xlsx file with VBA
Import an XML file into SQL Server without BULK
Use the XML file as a database
read an xml file in the database
Convert XML file to Flatten XML using C #
Insert an XML file into SQL Server
Text file to converted XML file
How to convert xml file to php array?
Convert XML files to JSON by ignoring attributes
insert the xml file into sql
Can I modify the package.xml file in SQL bootstrapper to install a named SQL server instance
How to create an XML file by SQL query?
Convert XML file to variable class?
Best practices for automating the creation of XML files for front-end access?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK