[Mongrel] Very basic question about REXML

Pawan Gupta pawan1gupta at yahoo.com
Sat Jul 14 12:17:55 EDT 2007


Hello Everybody, 
  I have pretty basic question abut REXML.  I want to put the String "John doe" in titles array, if attribute name is equal to "93".  Please see the code below. I could not find how to do it.. any help would be very appriciated. 

Here is the XML i am trying to parse 
<entrydata columnnumber="2" name="93">
      <text>John doe</text> 
 </entrydata>
 <entrydata columnnumber="1" name="86">
     <numberlist>
          <number>0</number> 
          <number>0</number> 
      </numberlist>
  </entrydata>


Code in controll
doc.elements.each('viewentries/viewentry/entrydata') do |ele|
    if ele.attributes["name"] = "93"
      titles <<  // here I like to put <text> value in titles array. 
   end
 end

Thanks, 
Pawan Gupta 
------------------------------------------------------------------------------------- 
Blog : http://www.xanga.com/pawan79


      ____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20070714/d9e12a4a/attachment-0001.html 


More information about the Mongrel-users mailing list