Q:

Importing XML file and then storing to pdf

I am fair new to Rails and stackoverflow.  I have a fields like for example name, address with text-fields in form, when filling those two fields it need to be submitted in xml file which stored in public folder of rails app.  
Example xml:
<name>abc</name>
<address>Madurai</address>

if there any solution please help me out.  Don't be serious if any mistakes

A:

<%= form_tag('/create_xml', :method=>'post') do %>
   <p>
       Name: <%= text_field_tag "name" %>
   </p>
   <p>
      Address: <%= text_field_tag "address" %>
   </p>
   <p>
       <%= submit_tag 'Submit' %>
   </p>
<% end %>

create_xml
def create_xml
    @data = params[:data]
    xml_file = Nokogiri::XML::Builder.new do |xml|
       xml.streams {
           xml.content {
              xml.name { xml.text @data }
           }
       }
    end

    file = File.new('data.xml','w')
    file.puts xml_file.to_xml
    file.close
end

