XML creation for millions of records

view story

http://stackoverflow.com – I have to create a single large XML file which will have more than 60 milllion records. I need a fast way to do this operation as it will be repeated on regular basis. I have data at two places In Database in two different tables. On File System In two pipe separated files. At present, I am trying to use StaX parser to create XML file in JAVA. Here I need to know whether I should use database / text file to read data and create XML file. Which one will be faster option ? Also, is there any specific API which handles creation / conversion for such large data to XML in optimized wa (HowTos)