title: (Ruby) How to import the data from my XML file into SQLite tables
body: <p>I want to import the data from an XML file into my SQLite tables. What should I do? I really need some help.
  Here is my code, I don't know what's wrong with these.</p>
  
  <pre><code>require 'rubygems'
  require 'nokogiri'
  require 'open-uri'
  class AddCoursesData &lt; ActiveRecord::Migration
    def up
      Course.delete_all
      courses = Nokogiri::XML(File.open("courses.xml"))
  
      courses.css('course').each do |node|
        children = node.children
  
        Course.create(
          acode: node['acode'],
          code: node['code'],
          sgid: node['sgid'],
          name: children.css('name').inner_text,
          ects: children.css('ects').inner_text,
          year: children.css('year').inner_text,
          period: children.css('period').inner_text,
          institute: children.css('institute').inner_text,
          description: children.css('description').inner_text,
          timetable: children.css('timetable').inner_text,
          lecture_material: children.css('lecture_material').inner_text,
          goals: children.css('goals').inner_text,
          participant_count: children.css('participant_count').inner_text,
          specialities: children.css('specialities').inner_text,
          examination: children.css('examination').inner_text
        )
  
      end
    end
  
    def down
    end
  end
  </code></pre>
  
  <p>and then I input</p>
  
  <pre><code>&gt;rake db:migrate  
  </code></pre>
  
  <p>it says</p>
  
  <pre><code>"rake aborted!
   cannot load such file -- nokogiri
   D:in 'migrate'
   Tasks: TOP=&gt; db:migrate"
  </code></pre>
  
  <p>I have installed nokogiri. I really don't know how to import these data. So can you help me with this? Thank you very much!!</p>
  
  <p>And here is my rubygems environment</p>
  
  <pre><code>D:\BitNami\rubystack\rubywork\UvAcourses&gt;gem env
  RubyGems Environment:
    - RUBYGEMS VERSION: 2.0.3
    - RUBY VERSION: 1.9.3 (2012-05-25 patchlevel 231) [i386-mingw32]
    - INSTALLATION DIRECTORY: D:/BitNami/rubystack/ruby/lib/ruby/gems/1.9.1
    - RUBY EXECUTABLE: D:/BitNami/rubystack/ruby/bin/ruby.exe
    - EXECUTABLE DIRECTORY: D:/BitNami/rubystack/ruby/bin
    - RUBYGEMS PLATFORMS:
      - ruby
      - x86-mingw32
    - GEM PATHS:
       - D:/BitNami/rubystack/ruby/lib/ruby/gems/1.9.1
       - C:/Users/Lulu/.gem/ruby/1.9.1
    - GEM CONFIGURATION:
       - :update_sources =&gt; true
       - :verbose =&gt; true
       - :backtrace =&gt; false
       - :bulk_threshold =&gt; 1000
    - REMOTE SOURCES:
       - https://rubygems.org/
  </code></pre>