Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails rexml命名错误-';元素';零级:零级_Ruby On Rails - Fatal编程技术网

Ruby on rails rexml命名错误-';元素';零级:零级

Ruby on rails rexml命名错误-';元素';零级:零级,ruby-on-rails,Ruby On Rails,我正在使用gdata ruby gem for Google API获取日历。 (根据) 问题是,即使日历提要具有有效的XML,我仍然会得到: NoMethodError(nil:NilClass的未定义方法“elements”): app/controllers/g_data_controller.rb:74:inblock in fetch_feed' app/controllers/g_data_controller.rb:63:infetch_feed' app/controllers/

我正在使用gdata ruby gem for Google API获取日历。 (根据)

问题是,即使日历提要具有有效的XML,我仍然会得到: NoMethodError(nil:NilClass的未定义方法“elements”): app/controllers/g_data_controller.rb:74:in
block in fetch_feed'
app/controllers/g_data_controller.rb:63:in
fetch_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 !

顺便说一句,我不确定这段代码是怎么回事,我正在使用rexml(正如google所建议的)来解析XMl元素。

让我澄清一下,feed变量包含日历的有效XMl。在打印它们之后,我已经进行了检查。@client.get(m.gcal_id).to_xml似乎返回nil。如果没有更多的代码来显示它在做什么,就很难判断问题出在哪里ocurring@aperture-feed变量包含从-@client.get(m.gcal_id).to_XML的有效XML。我已经打印了XML值并进行了检查。不是零。