From: Pierre Pat Date: 2009-03-18T14:15:33+09:00 Subject: REXML get specific element All, I'm trying for the first time to play with XML and Ruby. Since I have only the core library at the moment, my choice went directly for REXML. So, here is my problem. I'm willing to get a specific element in my xml file. Normally I would do something like this: doc.root.elements["programmer[@name='Matz']"] But let's say I have a user interface, and I let a user enter the programmer he wants to see. How can I look for an element using a variable? I hoped something like this would work: entered_name = 'Matz' doc.root.elements["magician[@name=#{entered_name}]"] Unfortunately, it didn't... After trying a few things, check with uncle google and in this forum, I'm driving out of clues, so I'd appreciate if someone could show me the correct way! Thanks. -- Posted via http://www.ruby-forum.com/.