From: Michael Malone Date: 2009-03-19T08:52:31+09:00 Subject: Re: how to output two data elements from simple XML Sorry, that was a terrible first answer. Righto, here goes: require 'rexml/document' include REXML f = File.new("AnimalXML.xml") doc = Document.new(f) #below ex. outputs the whole xml segment XPath.match(doc, "//Field FieldId").each do |e| puts "#{e.attribute('Path').to_s.gsub!('/Docs/Animal/', '')} #{e.attribute('Attribute')}" end Yes, removing /Docs/Animal/ like that isn't a brilliant idea, but it works. Enjoy, Michael ======================================================================= This email, including any attachments, is only for the intended addressee. It is subject to copyright, is confidential and may be the subject of legal or other privilege, none of which is waived or lost by reason of this transmission. If the receiver is not the intended addressee, please accept our apologies, notify us by return, delete all copies and perform no other act on the email. Unfortunately, we cannot warrant that the email has not been altered or corrupted during transmission. =======================================================================