activesupport/lib/active_support/xml_mini/rexml.rb
# Parse an XML Document string or IO into a simple hash.
#
# Same as XmlSimple::xml_in but doesn't shoot itself in the foot,
# and uses the defaults from Active Support.
#
# data::
#   XML Document string or IO to parse
Parse an XML Document string or IO into a simple hash.
Same as XmlSimple::xml_in but doesn't shoot itself in the foot,
and uses the defaults from Active Support.

:
XML Document string or IO to parse
Parse an XML Document string or IO into a simple hash . Same as XmlSimple :: xml_in but doesn ' t shoot itself in the foot and uses the defaults from Active Support . : XML Document string or IO to parse
def parse(data)
      if !data.respond_to?(:read)
        data = StringIO.new(data || '')
      end
      char = data.getc
      if char.nil?
        {}
      else
        data.ungetc(char)
        silence_warnings { require 'rexml/document' } unless defined?(REXML::Document)
        doc = REXML::Document.new(data)
        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
def parse ( data ) if ! data . respond_to? ( :read ) data = StringIO . new ( data || '' ) end char = data . getc if char . nil? { } else data . ungetc ( char ) silence_warnings { require 'rexml/document' } unless defined? ( REXML :: Document ) doc = REXML :: Document . new ( data ) 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
Parse an XML Document string or IO into a simple hash.
Parse an XML Document string or IO into a simple hash .
data
<not_specific>