Nokogiri parses and searches XML/HTML very quickly, and also has correctly implemented CSS3 selector support as well as XPath support. Nokogiri also features an Hpricot compatibility layer to help ease the change to using correct CSS and XPath.
acquired package info from repodata DB: repodata/69e709f4d2852d98f12867a74015d19384fe2727ff670fd70178cdde80b1e77e-primary.sqlite.bz2
Ruby standard for wrapping ruby libraries
The Ruby standard for publishing and managing third party libraries provided by RubyGems.
Manipulate and transform HTML/XML documents and fragments
Loofah is a general library for manipulating and transforming HTML/XML documents and fragments. It's built on top of Nokogiri and libxml2, so it's fast and has a nice API. Loofah excels at HTML sanitization (XSS prevention). It includes some nice HTML sanitizers, which are based on HTML5lib's whitelist, so it most likely won't make your codes less secure.