A few weeks ago, I spent quite a bit of time crafting the XML to load data into the databases. I have a tool that will do all of the heavy lifting. It is pretty self explanatory, you create a list of application types, instances where you associate it with the particular application type, create the IDXrefs and then create the elements. Here you choose the IDXref it's associated Application Instance and the the CommonID and the AppID. Then to make sure you don't over write another set of documents, you give it a base name, choose the folder, and the folder you want to save it in, and it will generate all of the files for you, including the setup.xml file. If there are duplicates on either the CommonID or AppID it will add a period to the end of the data.
Here are some screen shots of what it does:
Which results in the following in the xml files in the directory specified
And the best part:
If you would like this application, refer to the disclaimer on the right side of the screen, and then through my contacts page I will send you the application.