title: Nokogiri XML file output is located where?
body: <p>I need to generate an XML file with Ruby and/or Rails and have Nokogiri installed.</p>
  
  <ol>
  <li>In what file does the Ruby code go that will generate the XML file?</li>
  <li>How do I tell Nokogiri to generate the XML and put it into a file?</li>
  <li>Where is the XML output located?</li>
  </ol>
  
  <p>Here is my code from my controller file:</p>
  
  <pre><code>class MonkeyTalkController &lt; ApplicationController
  
  require 'rubygems'
  require 'nokogiri'
  
    def edit
  
    end
  
    def update
  #debugger
      render :text =&gt; MonkeyTalk.new(params).build_xml
  
      builder = Nokogiri::XML::Builder.new(:encoding =&gt; 'utf-8') do |xml|
        xml.root {
    xml.products{
           xml.widget {
            xml.id_ "10"
            xml.name "Awesome widget"
            }
          }
        }
  
        doc = Nokogiri::XML.parse(params)
        File.open('xml.out', 'w') do |fo|
        fo.print doc.to_s
        end
      end
      puts builder.to_xml
  
    end
  
  end
  </code></pre>
  
  <p>I need a basic understanding of the structure of Ruby and Rails applications and how Nokogiri works. </p>