You could do it in a couple of ways.
1. Parsing throught the XML using any of the parsers available or by trditional methods of parsing thro a text file, and understanding tokens and placing them next to each other in another text file with any delimeters that you want.
2. Write a program which will look for a file/document that describes the format of the text file you are dealing with and generates an XML out of the text file. This is more elegant, because it gives you the flexibility of converting flatfiles, XML in to one another. Once the program is written, all one needs to do is creating/manipulating the format file(.xfl) to deal with different flat files.
Check the following site out.
May be you can use it/buy it or get an idea of what you ned to do in your program