title: rake wont create XML file
body: <p>I'm a bit lost here as to why my <code>rake</code> task will not create the desired XML file, however it works fine when I have the method <code>build_xml</code> in an <code>.rb</code> file.</p>
  
  <pre><code>require 'rubygems'  
  require 'nokogiri'  
  require 'open-uri'  
  
  namespace :xml do
    desc "xml build test"
    task :xml_build =&gt; :environment do
      build_xml
    end 
  end
  
  def build_xml
    # build xml docoument
    builder = Nokogiri::XML::Builder.new do |xml|
      xml.root {
        xml.location {
          xml.value "test" 
        }
      }
    end
    File.open("test.xml", 'w') {|f| f.write(builder.to_xml) }
  end
  </code></pre>