-3

How to unzip a file from a folder, and then convert the XML document contained in this file, to a CSV format?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
abhinav singh
  • 856
  • 6
  • 23
  • 45

2 Answers2

1

You can simply use the java.util.zip.* classes to unzip the content of a ZIPped file.

Concerning your conversion from XML to CSV, it is difficult to tell you how you can achieve that without knowing the format of your XML data. However, the simplest thing is to parse the XML, then writing in parallel the content of your CSV file. The CSV format is really simple as it is only values separated by a specific character (generally a , ; or a tabulation).

Romain Linsolas
  • 79,475
  • 49
  • 202
  • 273
0

To unzip file use: java.util.zip.ZipFile

Converting .xml to .csv is less obvious. One of most popular XML parser is Xerces. Of course you can use XSLT to transform your file.

Michał Niklas
  • 53,067
  • 18
  • 70
  • 114