how to export data into xml and then import that data also

xml = question.to_xml

new_question =


You can use the ROXML lib to achieve it. ROXML is a Ruby library
designed to make it easier for Ruby developers to work with XML. Using
simple annotations, it enables Ruby classes to be mapped to XML. ROXML
takes care of the marshalling and unmarshalling of mapped attributes so
that developers can focus on building first-class Ruby classes.

You can refer to web site.

Easy to use.