I regularly use the MySQL database for online projects. MySQL is a very popular open source database that does a great job for small- to medium-scale applications. A nice front-end is available for MySQL called phpMyAdmin, which provides a web-based user interface for interacting with a MySQL database. phpMyAdmin provides a very easy-to-use export feature that will export any MySQL database as an XML document.
If you're interested in using MySQL and phpMyAdmin, please visit http://www.mysql.com/
and http://www.phpmyadmin.net/
. The details of installing and configuring a MySQL database are unfortunately beyond the scope of this lesson but you'll find plenty of information at the previously mentioned web sites.
To get started exporting an XML document from a MySQL database, open the database in phpMyAdmin, and select the table you want to export. Then click the Export tab. Within the Export options, click XML to indicate that XML is the output data format. If you want to generate an XML file that is stored on the web server, click the Save As File option. Otherwise, just click the Go button to generate the XML code and view it directly in the browser. Figure 19.3 shows how the exported XML document is shown in a web browser.
Figure 19.3. The newly exported XML document is immediately opened in the web browser.
Now you can choose to save the XML file locally or otherwise use the XML code for further processing and manipulation. The key point to realize is that with one button click you've converted an entire tabular database into a well-formed XML document.