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

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
  • Comment on Re^2: how to convert multiple xml files with different structure into CSV files

Replies are listed 'Best First'.
Re^3: how to convert multiple xml files with different structure into CSV files
by Corion (Patriarch) on Jul 17, 2014 at 08:29 UTC

    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.