Parsing XML with Hpricot, a Gem of a Ruby Gem
XML is often touted as being "human readable." In fact, the goal was to avoid having to spend too much time trying to parse the language at all. However, XML often falls short of that goal. Luckily for Ruby developers, a quick search for a parsing solution will turn up Hpricot. This Ruby gem can parse and manipulate XML with amazing flexibility and ease.
In his Web Developer's Virtual Library (WDVL) tutorial, Jason Gilmore introduces Hpricot, showing you how to begin using this powerful gem in ways that will leave you with plenty of time to read something far more exciting than XML.
Installing the Hpricot Gem
Next, install Hpricot by opening a terminal window and executing the following command:
%>gem install hpricot
You can confirm Hpricot installed correctly by firing up the interactive ruby shell, better known as the irb, and using the require method to load the Hpricot library:
%>irb irb(main):001:0> require 'hpricot' =>true irb(main):002:0>
With Hpricot installed, you're ready to begin parsing XML! Read the entire tutorial on parsing XML with Hpricot on WDVL.