class Nokogiri::XML::Node

def search *paths

See Node#xpath and Node#css.
optional hash of namespaces may be appended.
Search this node for +paths+. +paths+ can be XPath or CSS, and an
##
def search *paths
  ns = paths.last.is_a?(Hash) ? paths.pop :
    (document.root ? document.root.namespaces : {})
  xpath(*(paths.map { |path|
    path = path.to_s
    path =~ /^(\.\/|\/)/ ? path : CSS.xpath_for(
      path,
      :prefix => ".//",
      :ns     => ns
    )
  }.flatten.uniq) + [ns])
end