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
On Jul 14, 2007, at 12:17 , Pawan Gupta wrote:> 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 GuptaPawan this mailing list is for items regarding Mongrel (http:// mongrel.rubyforge.org/). Ask your question on the ruby mailing list (http://groups.google.com/ group/ruby-talk-google ). -- Wayne E. Seguin Sr. Systems Architect & Systems Admin wayneseguin at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20070714/419a904c/attachment.html