下記URL参考 http://www.nslabs.jp/ruby-rexml.rhtml まずサンプルの動きを確認してみます。 リファレンスに載っているプログラムをそのまま動かしてみます。 require 'rexml/document' doc = REXML::Document.new doc << REXML::XMLDecl.new('1.0', 'UTF-8') feed = doc.add_element("feed", {"xmlns" => "http://www.w3.org/2005/Atom"}) feed.add_element("title", {'type' => 'text'}).add_text "Netsphere Feed" doc.write STDOUT 実行結果です。 <?xml version='1.0' encoding='UTF-8'?>