in reply to how to convert multiple xml files with different structure into CSV files

For each different XML schema, you will have to define what constitutes a "row", and then read the XML file in, and for each "row" element, output all tag values that you have seen so far.

  • Comment on Re: how to convert multiple xml files with different structure into CSV files

Replies are listed 'Best First'.
Re^2: how to convert multiple xml files with different structure into CSV files
by pavithravenky (Initiate) on Jul 17, 2014 at 08:25 UTC
    The XML files that are created can be of different structures,threfore the xml schema cannot be defined, hence is there any option to define a genric code without explicitly defining the rows for each xml file

      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.

      A reply falls below the community's threshold of quality. You may see it by logging in.