I dont know what you are developing, but if you use a DB you might want to explore the possibility of letting the database handle XML generation for you.
I've recently seen this done in MS SQL Server, and it was incredibly easy to do. Instead of writing
Java code, just put the functionality into a SP. Has the added advantage of not needing a new software release of something has to change in retrieval of the resultset etc.
rgds,
Maarten