module MultiXml::Parsers::Rexml

def parse(xml)

XML Document string or IO to parse
xml::

Parse an XML Document string or IO into a simple hash
def parse(xml)
  if !xml.respond_to?(:read)
    xml = StringIO.new(xml || '')
  end
  char = xml.getc
  if char.nil?
    {}
  else
    xml.ungetc(char)
    doc = REXML::Document.new(xml)
    if doc.root
      merge_element!({}, doc.root)
    else
      raise REXML::ParseException, "The document #{doc.to_s.inspect} does not have a valid root"
    end
  end
end