Hpricot.XML()
The primary way to use Hpricot's XML mode is to call the Hpricot.XML method:
doc = open("http://redhanded.hobix.com/index.xml") do |f|
Hpricot.XML(f)
end
or
doc = Hpricot.XML(open("http://redhanded.hobix.com/index.xml"))
Also, :fixup_tags is canceled out by the :xml option. This is because :fixup_tags makes assumptions based how HTML is structured. Specifically, how tags are defined in the XHTML 1.0 DTD.
The inner_html method can still be used on nodes even though you're not working with HTML.
(doc/:item).each do |item| title = (item/:title).inner_html link = (item/:link).inner_html date = (item/'dc:date').inner_html # ... end
