orders_xml = %{
1
02/10/2008
C
}
require 'rexml/document'
orders = REXML::Document.new(orders_xml)
orders.root.each_element do |order| # each in
order.each_element do |node| # , , etc. in
if node.has_elements?
node.each_element do |child| # each - in
puts "#{child.name}: #{child.attributes['desc']}"
end
else
# the contents of , , etc.
puts "#{node.name}: #{node.text}"
end
end
end