From: Robert Klemme Date: 2011-11-25T20:11:07+09:00 Subject: Re: check if a element with a specific value exists in a xml using REXML On Fri, Nov 25, 2011 at 11:39 AM, Mithun P. wrote: > hi robert..thx for guiding me .. YWC > i found a way out in rexml though...wntd 2 share with you.. > >  foundnode = "no" >  xmldoc.elements.each("course/file"){ |element| >      nod = "content/t1/st_4/page2.swf" >      if element.text == nod >         foundnode = "yes" >      else >       foundnode = "no" >      end >      } Just be careful: variable foundnode cannot be used as a boolean because in Ruby any String is considered "true". Also, I don't understand why you do not use the XPath. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/