Skip to content

Instantly share code, notes, and snippets.

@Lytol
Created November 24, 2010 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lytol/712905 to your computer and use it in GitHub Desktop.
Save Lytol/712905 to your computer and use it in GitHub Desktop.
require "nokogiri"
doc = Nokogiri.XML(IO.read('products.xml'))
@products = doc.xpath("//products/product").map do |p|
{ :product_id => p.css("product_id").text, :product_url => p.css("product_url").text }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment