XmlMarkup : XML Builder « XML « Ruby






XmlMarkup


#!/usr/bin/env ruby

require 'rubygems'
require 'builder'
include Builder

document = XmlMarkup.new(:target => $stdout, :indent => 1)

document.instruct!

document.comment! "our good friend Mondo"

document.name( :lang => "en" ) {
  document.given "A", :nickname => "false"
  document.family "B"
}

 








Related examples in the same category

1.Create an XML document from a here document
2.Builder::XmlMarkup.new( :target => address, :indent => 1 )
3.Use builder to create an XML document from hash