Module: DarwinCore::XmlReader

Defined in:
lib/dwc_archive/xml_reader.rb

Overview

USAGE: Hash.from_xml:(YOUR_XML_STRING) modified from stackoverflow.com/questions/1230741/ convert-a-nokogiri-document-to-a-ruby-hash/1231297#1231297

Defined Under Namespace

Classes: Node

Class Method Summary collapse

Class Method Details

.from_xml(xml_io) ⇒ Object


9
10
11
12
# File 'lib/dwc_archive/xml_reader.rb', line 9

def self.from_xml(xml_io)
  result = Nokogiri::XML(xml_io)
  { result.root.name.to_sym => self::Node.new(result.root).value }
end