123456789_123456789_123456789_123456789_123456789_

Module: ActiveSupport::XmlMini_Nokogiri

Do not use. This module is for internal use only.
Relationships & Source Files
Namespace Children
Modules:
Super Chains via Extension / Inclusion / Inheritance
Instance Chain:
Defined in: activesupport/lib/active_support/xml_mini/nokogiri.rb

Constant Summary

XmlMini_Nokogiri::Conversions::Node - Included

CONTENT_ROOT

Instance Method Summary

  • #parse(data)

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

XmlMini_Nokogiri::Conversions::Node - Included

#to_hash

Convert XML document to hash.

XmlMini_Nokogiri::Conversions::Document - Included

Instance Method Details

#parse(data)

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

data

XML Document string or IO to parse

[ GitHub ]

  
# File 'activesupport/lib/active_support/xml_mini/nokogiri.rb', line 19

def parse(data)
  if !data.respond_to?(:read)
    data = StringIO.new(data || "")
  end

  if data.eof?
    {}
  else
    doc = Nokogiri::XML(data)
    raise doc.errors.first if doc.errors.length > 0
    doc.to_hash
  end
end