How can form data be used to make an XML file?

I have a scenario. Ignore this if it is silly. I have a form like a data
entry. It has 3 fields which are name, age and gender. The guy who
enters the data adds more fields with the help of an Add another Entry
link which brings a set of the 3 fields with the help of a partial which
has the form with 3 fields. After he finishes all the entries he Submits
which must generate an XML file which will be saved in the file system.
My question is how to pass the set of entered data to create the XML.
XML can be built using XML builder function and file can be saved. But i
need to know how this data can be passed to the controller for XML
generation. Please help. Thank you

The XML would be for example

   <student name="Mark" age="25" gender="Male"/>
   <student name="Sarah" age="25" gender="Female"/>

Why don't you just save the data to the database and serve it as xml
when the xml is needed? This way you can do more than just xml with
the data?

If that's not an option you can setup a session model that can store
the data when it comes back to the controller... Just setup form_tags
that has student_1 student_2 ... and save the data one by one...

I'm thinking student_form has_many students and just use the