From: djberg96@... (Daniel Berger) Date: 2004-09-03T14:20:18+09:00 Subject: rexml help Hi all, After futzing with REXML and reading over the API I'm not quite "getting it". I have a file that looks more or less like this: foo john blah bar jane hello foo jack pfft Given a name, I want to be able to grab the login and password. Or, given both a name and a login, I want to be able to find the password. In the event I am only given a name, and there is more than one entry with that name, I want the first entry (from a top down perspective). What is the shortest route to accomplish this with rexml? I've been futzing around with each, each_element, root, get_text - but I'm just not quite getting the hang of it. To look at all of the text I did something like this: doc = Document.new(File.new("dbrc.xml")) doc.elements.each("/dbrc"){ |node| node.each_element{ |element| element.each_element{ |e| puts e.get_text.value } } } But, I need to narrow it down more and be able to focus in on only the elements I need. What's the best/quickest/easiest way to accomplish this? Regards, Dan