module Hpricot::Doc::Trav

def root

def root
  es = []
  children.each {|c| es << c if c.elem? }
  raise Hpricot::Error, "no element" if es.empty?
  raise Hpricot::Error, "multiple top elements" if 1 < es.length
  es[0]
end