# File activesupport/lib/active_support/xml_mini/rexml.rb, line 18
def parse(data)
if !data.respond_to?(:read)
data = StringIO.new(data || '')
end
if data.eof?
{}
else
silence_warnings { require 'rexml/document' } unless defined?(REXML::Document)
doc = REXML::Document.new(data)
if doc.root
merge_element!({}, doc.root, XmlMini.depth)
else
raise REXML::ParseException,
"The document #{doc.to_s.inspect} does not have a valid root"
end
end
end