Parsing XML with Ruby

后端 未结 2 815
野的像风
野的像风 2020-12-05 01:53

I\'m way new to working with XML but just had a need dropped in my lap. I have been given an usual (to me) XML format. There are colons within the tags.

<         


        
2条回答
  •  一个人的身影
    2020-12-05 02:24

    If in a Rails environment, the Hash object is extended and one can take advantage of the the method from_xml:

    xml = File.open("myfile.xml")
    data = Hash.from_xml(xml)
    

提交回复
热议问题