开发者

rexml NoMethodError- 'elements' for nil:NilClass

开发者 https://www.devze.com 2023-02-16 05:18 出处:网络
I am using gdata ruby gem for Google APIs to get Calendars. (as per http://code.google.com/apis/gdata/articles/gdata_on_rails.html#ClientLogin)

I am using gdata ruby gem for Google APIs to get Calendars. (as per http://code.google.com/apis/gdata/articles/gdata_on_rails.html#ClientLogin)

Problem is that even if the calendar feed has valid XML, I keep on getting : NoMethodError (undefined method 'elements' for nil:NilClass): app/controllers/g_data_controller.rb:74:in block in fetch_feed' app/controllers/g_data_controller.rb:63:infetch_开发者_运维技巧feed' app/controllers/g_data_controller.rb:122:in `index'

feed= @client.get(m.gcal_id).to_xml
if feed
   entry=feed.elements['entry']    #Error on this line !

Not sure what is the matter with this code BTW, I am using rexml (as suggested by google) to parse the XMl elements.

0

精彩评论

暂无评论...
验证码 换一张
取 消