
- Ruby on Rails Tutorial
- Ruby on Rails - Home
- Ruby on Rails - Introduction
- Ruby on Rails - Installation
- Ruby on Rails - Framework
- Ruby on Rails - Directory Structure
- Ruby on Rails - Examples
- Ruby on Rails - Database Setup
- Ruby on Rails - Active Records
- Ruby on Rails - Migrations
- Ruby on Rails - Controllers
- Ruby on Rails - Routes
- Ruby on Rails - Views
- Ruby on Rails - Layouts
- Ruby on Rails - Scaffolding
- Ruby on Rails - AJAX
- Ruby on Rails - File Uploading
- Ruby on Rails - Send Emails
- Ruby on Rails Resources
- Ruby on Rails - References Guide
- Ruby on Rails - Quick Guide
- Ruby on Rails - Resources
- Ruby on Rails - Discussion
- Ruby Tutorial
- Ruby Tutorial
Rails and XML - RXML
Following is the example on how to create XML using 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 "jcfischer@gmail.com" 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
Please check the link on XML Builder.
rails-references-guide.htm
Advertisements