CSV to XML

CSV to XML

csvToXML.rb

If you want to populate information to the Web, Extensible Markup Language (XML) is a good format to use. The reason XML is so cool is because the format enables different systems to share data using a common format that the developer can design. This script will take the information stored in a CSV file and, instead of just outputting the comments to the user's terminal, will produce an XML file.

The Code

 require 'faster_csv'

 print "CSV file to read: " infile = gets.strip print "What do you want to call each element: ...

Get Wicked Cool Ruby Scripts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.