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

**URL:** <https://www.ruby-forum.com/t/how-can-form-data-be-used-to-make-an-xml-file/151015>\
**Category:** Rails\
**Created:** [October 15, 2008, 10:45pm UTC](https://www.ruby-forum.com/t/how-can-form-data-be-used-to-make-an-xml-file/151015 "2008-10-15T22:45:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rocknrollcar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f14d63/32.png) [@rocknrollcar](https://www.ruby-forum.com/u/rocknrollcar)\
**Post date:** [October 15, 2008, 10:45pm UTC](https://www.ruby-forum.com/t/how-can-form-data-be-used-to-make-an-xml-file/151015/1 "2008-10-15T22:45:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rocknrollcar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f14d63/32.png) [@rocknrollcar](https://www.ruby-forum.com/u/rocknrollcar)\
**Post date:** [October 15, 2008, 10:47pm UTC](https://www.ruby-forum.com/t/how-can-form-data-be-used-to-make-an-xml-file/151015/2 "2008-10-15T22:47:12Z")

</div>

The XML would be for example

---

<div class="post-metadata">

**Author:** ![rocknrollcar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f14d63/32.png) [@rocknrollcar](https://www.ruby-forum.com/u/rocknrollcar)\
**Post date:** [October 16, 2008, 3:14am UTC](https://www.ruby-forum.com/t/how-can-form-data-be-used-to-make-an-xml-file/151015/3 "2008-10-16T03:14:20Z")

</div>

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  
database…
