XML Ruby

xml = %{

 
 
   
    
   
 
 
  
 
}
require 'rexml/document'
doc = REXML::Document.new xml
def describe(fish)
  "#{fish.attribute('size')} #{fish.attribute('color')} fish"
end
REXML::XPath.each(doc, '//fish/fish') do |fish|
  puts "#{describe(fish.parent)} #{describe(fish)}."
end