Rendering XML to a web page

I have a couple of issues...

First my XML looks like this: <questionaire> ...<questions> ......<question> .........<dbref> .........<items> ............<item> ...............<text>Here is the answer to your question</text> ............</item> .........</items> .........<text>Here is the question</text> ......</question> ...</questions> </questionaire>

So basically i would like to output each question within the questionaire along with the answer to a web page. i.e. <span>Here is the question</span> <span>Here is the answer to your question</span>

My CONTROLLER looks like this:

def show_questionaire require 'rexml/document' @xml_q = Questionaire.find(params[:id]) #get the xml string from the database @doc_xml = REXML::Document.new(@xml_q.que_result) end

My VIEW currently looks like this: <% @doc_xml.elements.each("//question/text) do |element| %> <div> <%= element[0] %> </div> <% end %>

This outputs the list of questions, but i can't seem to understand how to display the answer in the same loop...

Please help,

Thanks,

Mike P.S. i've read the REXML tutorial, but again i can't see how to get two elements at the same time...