That is not possible in the general case.
I've done something like counting the tag that occurs the most and then using the topmost tag of such tags as the "row" tag, but if you haven't spent enough time on the problem and don't know the limitations of this approach, it just won't work for you.
My opinion is that without human input, it is a futile approach to try to convert XML to CSV and to expect good results.
For learning about how to convert XML to CSV, consider opening the XML files in Excel 2010 and watch how Excel converts them to tabular structure. If you find that Excel converts all your files to a suitable (and stable) tabular structure, you will find that my approach of using the most frequent tag as the "row" tag will likely work too.
|