Module: ActiveSupport::XmlMini_Nokogiri
- Extended by:
- XmlMini_Nokogiri
- Includes:
- Conversions::Document, Conversions::Node
- Included in:
- XmlMini_Nokogiri
- Defined in:
- activesupport/lib/active_support/xml_mini/nokogiri.rb
Overview
:nodoc:
Defined Under Namespace
Modules: Conversions
Constant Summary
Constants included from Conversions::Node
Conversions::Node::CONTENT_ROOT
Instance Method Summary collapse
-
#parse(data) ⇒ Object
Parse an XML Document string or IO into a simple hash using libxml / nokogiri.
Methods included from Conversions::Node
Methods included from Conversions::Document
Instance Method Details
#parse(data) ⇒ Object
Parse an XML Document string or IO into a simple hash using libxml / nokogiri.
- data
-
XML Document string or IO to parse
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# 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 |