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 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…
Smit S. 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 P.
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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs