ã¬ã¹ãã³ã¹ãXMLã®å ´åããã¡ãã¡REXMLã§èª¿ã¹ã¦ããã®ãããã©ãããã®ã§ä¸æ°ã«Hashãªãã¸ã§ã¯ãã®Arrayã«å¤æããã³ã¼ããã«ãã«ããåã«ãã©ããã§ä½¿ã£ããª...ã¨æã£ããY!ã®å½¢æ ç´ è§£æã使ã£ãæã§ãããæè¿ã¯JSONã¨ãã§åãåãã§ããAPIãå¤ããªã£ã¦ãããã©ãæã å¿ è¦ã«ãªãããæ¨æºã®REXMLã ãã§è§£æã§ããã®ãã¤ã¤ç¹ãªã®ã§å ¬éãã¦ããã¾ããç°¡åãªXMLã®ã¬ã¹ãã³ã¹ãªãå¾ã§ä½¿ãããããªãã¾ããã require 'rexml/document' def xml2sym(doc) res = Array.new return res if doc.nil? doc.each_element{|item| hash = Hash.new item.each_element{|e| hash[e.name.to_sym] = e.text } res << hash } res
{{#tags}}- {{label}}
{{/tags}}