Module: MultiXml::Parsers::Rexml

Extended by:
Rexml
Included in:
Rexml
Defined in:
lib/multi_xml/parsers/rexml.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#parse(xml) ⇒ Object

Parse an XML Document IO into a simple hash using REXML

xml:: XML Document IO to parse

Raises:

  • (REXML::ParseException)

16
17
18
19
20
# File 'lib/multi_xml/parsers/rexml.rb', line 16

def parse(xml)
  doc = REXML::Document.new(xml)
  raise(REXML::ParseException.new("The document #{doc.to_s.inspect} does not have a valid root")) unless doc.root
  merge_element!({}, doc.root)
end

#parse_errorObject


8
9
10
# File 'lib/multi_xml/parsers/rexml.rb', line 8

def parse_error
  ::REXML::ParseException
end