More and more data is being stored as XML. However, SQL databases are still behind most websites and applications. At some point you may have to convert XML data to SQL statements for storage in a database. You may be tempted to do this by hand or write your own custom script to do the conversion. There are many applications that perform this function automatically. The most straightforward program available for this task is Advanced XML Converter.
Convert an XML Document to SQL
Advanced XML Converter is available as a free download. Refer to the resources for the download link. Click on "axcsetup.exe" to download the installer. Run the installer. You will be asked to select your language and accept the license agreement. The free version does not require you to enter any license keys or other information.
Video of the Day
Open Advanced XML Converter. Make sure that you have your source XML document saved in a readable directory. Check that the the XML is well-formatted. Click "File" from the menu. Select "Open" and search for the target XML document. Click "Open." If the file opens successfully you will see a tree of the XML structure in the left pane and a preview of the table structure in the right pane.
You are now ready to convert. Click "File" from the menu. Select "Export tables." A dialog window will open. Select "sql" from the drop-down menu labeled "File type." Click "Browse" if you need to create a new file name for the SQL output file or if you need to save it in a location other than the default. Click the "Convert" button. After the conversion completes, open the destination folder and ensure that your XML document converted to SQL successfully.
Things You'll Need
XML Source File
Advanced XML Converter
Altova XMLSpy is another program that can interface XML documents with a database. Refer the resources for the download link. Unlike Advanced XML Converter, it does not output a SQL file. It is useful if you have an existing database connection and would prefer to insert the XML directly into a table without generating a SQL file.
The free trial of Advanced XML Converter limits you to 50 rows of data. You may consider purchasing the full version. Otherwise, you may want to only use it with smaller XML documents. You can also split your document, convert piece-by-piece and join into one larger SQL statement.