I meet a case just like you .The diffrence is database.
In my case,The database is Oracle.
and load the data then write the data in xml filse.
I use Caster and xsd to realize it.
I use xsd file to create some bean(JBuilder will be helpful), and later I use these
beans,to write to xml files.
Maybe you can get more info at www.google.com.