The libxml-ruby gem provides appropriate bindings for the libxml2 XML toolkit provided by Gnome.
Is there an easy way to convert a Nokogiri XML document to a Hash? Something like Rails' Hash.from_xml.