Builder::XmlMarkup.new( :target => address, :indent => 1 ) : XML Builder « XML « Ruby






Builder::XmlMarkup.new( :target => address, :indent => 1 )


#!/usr/bin/env ruby

require 'rubygems'
require 'builder'

address = <<XML
<address>
 <name><given>M</given><family>M</family></name>
 <street>St.</street>
 <city>G</city>
 <state>C</state>
 <code>81</code>
 <country>USA</country>
</address>
XML

document = Builder::XmlMarkup.new( :target => address, :indent => 1 )
puts document.to_xs

 








Related examples in the same category

1.Create an XML document from a here document
2.Use builder to create an XML document from hash
3.XmlMarkup