Module: ActiveSupport::XmlMini_Nokogiri

Extended by:
XmlMini_Nokogiri
Included in:
XmlMini_Nokogiri
Defined in:
lib/active_support/xml_mini/nokogiri.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Conversions

Instance Method Summary collapse

Instance Method Details

#parse(string) ⇒ Object

Parse an XML Document string into a simple hash using libxml / nokogiri.

string

XML Document string to parse



11
12
13
14
15
16
17
18
19
# File 'lib/active_support/xml_mini/nokogiri.rb', line 11

def parse(string)
  if string.blank?
    {}
  else
    doc = Nokogiri::XML(string)
    raise doc.errors.first if doc.errors.length > 0
    doc.to_hash
  end
end