Use rexml to read xml file
File: matz.xml <hello>Matz!</hello> #!/usr/bin/env ruby require "rexml/document" file = File.new( "m.xml" ) doc = REXML::Document.new file puts doc.to_s