Using the DOM XML functions to create XML files from SQL data
This tutorial is intended for developers who wish to extract data from a database and insert it into XML files so that it can be processed in some way, usually by transforming it into HTML using an XSL file.
http://www.zend.com/zend/tut/tutorial-DOM-XML.php