class Nokogiri::XML::NodeSet

def xpath *paths

For more information see Nokogiri::XML::Node#xpath

Search this NodeSet for XPath +paths+
##
def xpath *paths
  handler = ![
    Hash, String, Symbol
  ].include?(paths.last.class) ? paths.pop : nil
  ns = paths.last.is_a?(Hash) ? paths.pop : nil
  sub_set = NodeSet.new(document)
  each do |node|
    sub_set += node.xpath(*(paths + [ns, handler].compact))
  end
  document.decorate(sub_set)
  sub_set
end