From: "Charles L. Snyder" Date: 2005-06-06T23:40:26+09:00 Subject: rexml child nodes Hi, I having been learning to use ruby for about 1 week (v. new). I am trying to use ruby w rexml to read in xml documents of the form: 3 1 2 6 I am able to get the Questions with: require "rexml/document" include REXML doc = Document.new File.new("CVPhys.xml") quiz=[] doc.elements.each("QUIZ/QUESTION") { |element| quiz.push element.attributes["TEXT"] } puts quiz But, I can't figure out A) how to get at the vaules in the nodes - the code below just gives me results of the form "6" require "rexml/document" include REXML doc = Document.new File.new("myQuiz.xml") quiz=[] doc.elements.each("QUIZ/QUESTION/CHOICE") { |element| quiz.push element} puts quiz And B) how to read the xml doc line by line to output as a file with the ultimate form: What is 1 +1 3 False! The answer is 2 1 False! The answer is 2 2 True! The answer is 2 6 False! The answer is 2 Thanks !