Class: ChainReactor::Parsers::XmlSimpleParser

Inherits:
Parser
  • Object
show all
Defined in:
lib/chain-reactor/parsers/xml_simple_parser.rb

Overview

Parse the string using the xml simple library.

Instance Method Summary collapse

Methods inherited from Parser

#initialize, #parse

Constructor Details

This class inherits a constructor from ChainReactor::Parsers::Parser

Instance Method Details

#do_parse(string) ⇒ Object

Parse an XML string, returning the result as a hash.

Raises a ParseError on failure.



11
12
13
14
15
16
17
18
# File 'lib/chain-reactor/parsers/xml_simple_parser.rb', line 11

def do_parse(string)
  begin
    @log.debug { "Parsing XML string #{string.inspect}" }
    XmlSimple.xml_in(string)
  rescue StandardError => e
    raise ParseError, "Data from client is not a valid XML string: #{string}, #{e.class.name} error: #{e.message}, data: #{string}"
  end
end