Before you start
This tutorial is for a general programming crowd interested in learning the basics of setting up a skeleton Rails application and using Ruby and Rails to process XML. Beginner and intermediate programmers or people who have a little bit of exposure to Rails will likely benefit the most. It will spend a brief amount of time discussing Rails in general, and Ruby syntax as necessary, but these topics are covered in much better detail elsewhere. Please see Resources for additional information.
Today you will build a Rails application, discuss some basics about the way that Rails works, how it's structured and how to use it, and then you'll move on to working with XML. There are a number of ways to both generate and parse XML in Ruby, and you'll look at a few of them, including REXML (Ruby Electric XML), Builder and Hpricot (Technically Hpricot is an HTML parser -- but it's fast, and works on XML, too).
The following tools are needed to follow along with this tutorial:
- Ruby -- If you run Windows, your best bet is to download the One-Click Ruby Installer. If you use some variation of Linux or Mac OS X, you might already have Ruby installed. If not, you can download it from http://www.ruby-lang.org. The installation instructions are straightforward. Version 1.8.4 or 1.8.5 is recommended.
- RubyGems -- Get the gems you need, and install Rails, Builder and Hpricot if you haven't already.
- Rails -- You can install Rails through RubyGems. While not really part of this discussion, you figure all that out at http://www.rubyonrails.com/down. You'll use version 1.2.2 for this tutorial.
- Builder -- Install through RubyGems.
- Hpricot -- Install through RubyGems.
One of the beautiful things about Rails is how easy it is to perform object persistence and relational mapping. Since you'll only deal with XML in this tutorial, you won't actually use a database for anything.
To actually run the demo application, it's worth noting that the only thing you should have to do is to start the application. You can see how to do that in Start up the server.
Also, you'll be provided with a list of all of the files that have been explicitly created or modified aside from those that will be generated by Rails. These include:
- app/controllers/main_controller.rb
- views/layouts/main.rhtml
- views/main/index.rhtml
- public/stylesheets/reset-fonts-grids.css
- public/stylesheets/style.css


