From: aidy Date: 2008-07-01T01:32:19+09:00 Subject: is it possible to create a hash dynamically? Hi, I am trying to build a dynamic hash map def extract(xml, path) require 'rexml/document' xml = xml.to_s.gsub("utf-16", "utf-8") doc = REXML::Document.new(xml) doc.root.each_element(path) do |element| element.each_element do |node| puts "name: #{node.name} text: #{node.text}" @xml_data = {node.name => node.text} end end return @xml_data end However, the @xml_data is always returning 1 element Thanks Aidy