Convert XML collection (of Pivotal Tracker stories) to Ruby hash/object

前端 未结 5 1465
北海茫月
北海茫月 2021-02-06 17:44

I have a collection of stories in an XML format. I would like to parse the file and return each story as either hash or Ruby object, so that I can further manipulate the data wi

5条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-06 18:01

    This xml is generated by Rails' ActiveRecord#to_xml method. If you are using rails, you should be able to use Hash#from_xml to parse it.

提交回复
热议问题