xml = question.to_xml
new_question = Question.new(Hash.create_from_xml(xml))
jeremy
xml = question.to_xml
new_question = Question.new(Hash.create_from_xml(xml))
jeremy
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 http://roxml.rubyforge.org/#quickstart web site.
Easy to use.