A seguir está o exemplo de como criar XML usando Rails -
xml.instruct! # <?xml version = "1.0" encoding = "UTF-8"?>
xml.comment! "a comment" # <!-- a comment -->
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
xml.title "My Atom Feed"
xml.subtitle h(@feed.subtitle), "type" => 'html'
xml.link url_for( :only_path => false, :controller => 'feed', :action => 'atom' )
xml.updated @updated.iso8601
xml.author do
xml.name "Jens-Christian Fischer"
xml.email "[email protected]"
end
@entries.each do |entry|
xml.entry do
xml.title entry.title
xml.link "href" => url_for ( :only_path => false,
:controller => 'entries', :action => 'show', :id => entry )
xml.id entry.urn
xml.updated entry.updated.iso8601
xml.summary h(entry.summary)
end
end
end
Verifique o link no XML Builder .
rails-reference-guide.htm