how to read XML with ruby -
Is there any way to read XML with Ruby and get properties easily? what might happen? I want to see Mary or Johns ID. (John ['id']?) Try Xmlfile) # Now root element root = xmldoc.root puts "root element:" + root.attributes ["shelf"] # All this movie titles will be produced Xmldoc.elements.each ("archive / movie") {| E Puts "movie title:" + e.attributes ["title"]} & lt; People & gt; & Lt; John ID = 1 & gt; & Lt; / John & gt; & Lt; My id = 2 & gt; & Lt; / My & gt; & Lt; / People & gt;
Comments
Post a Comment