module MultiXml

def parse(xml, options={})

:typecast_xml_value :: If true, won't typecast values for parsed document

:disallowed_types :: Types to disallow from being typecasted. Defaults to `['yaml', 'symbol']`. Use `[]` to allow all types.

: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 ||= ''
  options = DEFAULT_OPTIONS.merge(options)
  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 = undasherize_keys(parser.parse(xml) || {})
    hash = options[:typecast_xml_value] ? typecast_xml_value(hash, options[:disallowed_types]) : hash
  rescue DisallowedTypeError
    raise
  rescue parser.parse_error => error
    raise ParseError, error.message, error.backtrace
  end
  hash = symbolize_keys(hash) if options[:symbolize_keys]
  hash
end