ActiveSupport adds a Hash.from_xml
, which does the conversion in a single call. Described in another question: https://stackoverflow.com/a/7488299/937595
Example:
require 'open-uri'
remote_xml_file = "https://www.example.com/some_file.xml"
data = Hash.from_xml(open(remote_xml_file))