class Hpricot::Elem

def output(out, opts = {})

def output(out, opts = {})
  out <<
    if_output(opts) do
      "<#{name}#{attributes_as_html}" +
        ((empty? and not etag) ? " /" : "") +
        ">"
    end
  if children
    children.each { |n| n.output(out, opts) }
  end
  if opts[:preserve]
    out << etag if etag
  elsif etag or !empty?
    out << "</#{name}>"
  end
  out
end