require 'rexml/document'xml = < P Male F Male END_XMLtree = REXML::Document.new(xml)tree.elements.each("people/person") do |person| puts person.get_elements("name").firstend