- 4chan hell raisers finding fame brings heat?
- The 10 dumbest mistakes network managers make
- NetApp quits bidding war in face of EMC opposition
- CompuServe closes after 30 years
- Google to launch open-source Chrome OS this year
What's the easiest way to convert data stored in comma-separated value files into XML format? We need to use the names in the header row of the CSV file for the XML element names and create a basic XML document containing <rows> filled with the named elements containing our data values.
You can find CSV-to-XML conversion programs with a simple Web search.
The easiest solution is to let somebody else do it. A free online conversion utility found in the Tools section at www.creativyst.com will transform files up to 250K bytes using a simple Web form.
Paste your CSV data into the form, and copy the XML results back using your browser. Kirk Evans describes how to convert CSV to XML using XSLT and the XPATH functions substring-before() and substring-after() to parse the rows and values on the weblogs.asp.net site (details here). You have to wrap the CSV data in an XML <root> tag to process the file with XSLT.
For converting large numbers of large CSV files, you will want a stand-alone desktop program, such as the CSV 2 XML Converter from www.goedeke.net, which lets you output multiple XML formats from existing CSV files.
Comment