First, Introduction
Since the advent of Ruby on Rails last year, interest in the Ruby programming language seems to have grown steadily. Rails has helped people see what Ruby is: A very decent, easy to learn and fun-filled language, even for the development of industrial-grade applications. Ruby is now almost the same age as Java, but until now it has attracted people's attention.
Ruby, of course, has caught my eye! Lately, I've found myself using Ruby more than Java, because it helps me encode faster-the same work, but less keystrokes. I simply doubted whether I had actually given up Java completely and turned to Ruby. When you've finished reading this, you'll understand why.
Builder is a lightweight XML builder that originally came from rails engineering. Now, it's a standalone Ruby library that you can download from RubyForge.
This article describes how to install builder and then use Builder in Ruby to create XML documents without the need for rails. Of course, I don't involve all the features of builder, but it's enough for the content in this article. Of course, you can refer to builder's online documentation for detailed analysis.
Second, install Ruby and builder
First, let's go to the Ruby download page. You can download the current stable release version at this address. If you are using a Windows platform, the easiest way to install Ruby is to use one-click Ruby Installer (version 1.8.2), and if you use a different platform, you can use the 1.8.3 version, which is a file that is compressed by tar and gzip. (By the way, version 1.8.2 is recommended for rails, while the 1.8.4 version is in the preview release phase). You can test your installation by typing "ruby-v" on the command line. If Ruby has a response, then you may be successful, and if there are some prompts from the operating system, it is likely that there is a problem with your installation.
To date, the easiest way to install Builder is to use RubyGems, an excellent package management program for Ruby. I'll just make a brief introduction here. First, download the RubyGems and run "Ruby setup.rb". After you install RubyGems, enter the following statement in a shell:
Gem Install Builder
If all goes well, you should see the following response:
Attempting local installation of 'builder'
Local gem file not found: builder*.gem
Attempting remote installation of 'builder'
Updating Gem source index for: http://gems.rubyforge.org
Successfully installed builder-1.2.4
Installing RDoc documentation for builder-1.2.4...
Once Ruby and builder are in place, you can start working.