From: David Masover Date: 2010-04-11T09:26:43+09:00 Subject: Re: XML to CSV On Thursday 08 April 2010 01:25:05 pm Stuart Clarke wrote: > My code thus far is > > require 'rexml/document' REXML probably isn't the best place to start. > xml = REXML::Document.new(File.open("H:\\test.xml")) > csv_file = File.new("H:\\data.csv", "w") > xml.elements.each("//event") do |e| > csv_file.puts e.attributes['id'] << "|" << > e.elements['object class="com.########l"'].text << "|" << > e.elements['void property="###########"/long'].text << "|" << > e.elements['void property="description"/string'].text << "|" << > e.elements['void property="downloaded"/long'].text > end > > > This is however failing. That's like saying "My computer broke" -- it tells us absolutely nothing. How is it failing? What happens when you try to do that? Does it raise an exception? Does it create a CSV file that doesn't work? Does it empty your bank accounts and go to Vegas?