I have a couple of issues…
First my XML looks like this:
…
…
…
…
…
…Here is the answer to your question
…
…
…Here is the question
…
…
So basically i would like to output each question within the
questionaire along with the answer to a web page. i.e. Here is
the question Here is the answer to your question
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| %>
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…