require 'rubygems' require_gem 'builder' xmlobj= Builder::XmlMarkup.new(:target=>STDOUT, :indent=>2) xmlobj.person { |b| b.name("Jim"); b.phone("555-1234") } # # Prints: # <person> # <name>Jim</name> # <phone>555-1234</phone> # </person> require 'rubygems' require_gem 'builder', '~> 2.0' xml = Builder::XmlMarkup.new xmlobj = xml.person { |b| b.name("Jim"); b.phone("555-1234") } xmlobj #=> <person>