Hi All... I am trying to parsing data from XML. But I am not able to store it in database. Anyone have any idea about that??? Thanks in advance....
on 2009-09-29 13:00
on 2009-11-07 07:09
Smit Shah wrote: > Hi All... > > I am trying to parsing data from XML. But I am not able to store it in > database. > Anyone have any idea about that??? > > Thanks in advance.... Hi smit, As you parse the xml data using feednormalizer gem. so you get it's result in hash. now running loop for that hash, you are able to store xml data to your table. look below code, hope it's solve your problem. @rss = FeedNormalizer::FeedNormalizer.parse open(feed_url) if !@rss.entries.blank? for rss in @rss.entries @record = Model.new @record.url = rss.url Same way fill other attributes.. in that table @record.save end end Thanks, Priyanka Pathak
on 2010-03-04 03:07
you could also use rexml http://www.germane-software.com/software/rexml/doc...
on 2010-10-12 15:41
rexml is a gem which can be used to parse xml into the DB dynamically. you have to first store the xml into an array and then use for loop and insert function to store in mysql.