module MultiXml

def parse(xml, options={})

:symbolize_keys :: If true, will use symbols instead of strings for the keys.

Options

Parse an XML string or IO into Ruby.
def parse(xml, options={})
  xml ||= ''
  xml.strip! if xml.respond_to?(:strip!)
  begin
    xml = StringIO.new(xml) unless xml.respond_to?(:read)
    char = xml.getc
    return {} if char.nil?
    xml.ungetc(char)
    hash = typecast_xml_value(undasherize_keys(parser.parse(xml))) || {}
  rescue parser.parse_error => error
    raise ParseError, error.to_s, error.backtrace
  end
  hash = symbolize_keys(hash) if options[:symbolize_keys]
  hash
end