#sample solution for Code tab
require "rexml/document"
file = File.open("pets.txt")
doc = REXML::Document.new file
file.close
doc.elements.each("pets/pet/name") do |element|
puts element
end
puts ''
doc.elements.each("pets/pet/species") do |element|
puts element
end
No comments:
Post a Comment