I know this might be a dumb question. I'm trying to use this xml parser
http://nokogiri.rubyforge.org/nokogiri/Nokogiri.html
I've put the code below in a controller in a bringRSS method(?), and it works fine in IRB. But how do I get values for puts link.content into my views
def bringRSS
require 'nokogiri'
require 'open-uri'
# Get a Nokogiri::HTML:Document for the page we’re interested in...
doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove'))
# Do funky things with it using Nokogiri::XML::Node methods...
####
# Search for nodes by css
doc.css('h3.r a.l').each do |link|
puts link.content
end
####
# Search for nodes by xpath
doc.xpath('//h3/a[@class="l"]').each do |link|
puts link.content
end
####
# Or mix and match.
doc.search('h3.r a.l', '//h3/a[@class="l"]').each do |link|
puts link.content
end
end