GData 错误:间歇性“无效根元素”
我正在使用 Java GData 包发送 GData 查询来为 Instructables.com 用户呈现流量图表。但是,有时会引发此异常:
[Line 1, Column 0] Invalid root element, expected (namespace uri:local name) of (http://www.w3.org/2005 Atom:feed), found (:feed
我在网上可以找到的唯一提及此错误的是 此处,但我非常确定我们的提要 URL 格式正确。例如,下面是我们可能发送的 URL:
https://www.google.com/analytics/feeds/data?ids=ga:472899&metrics=ga:uniquePageviews&dimensions=ga:date&start-date=2009-10-12&end-date=2009-11-11&filters=ga:pagePath==/id/Inverted_Bookshelf/,ga:pagePath==/id/Munny-Speakers/,ga:pagePath==/id/Zippo-Trick%253a-The-Twilight-Zone/,ga:pagePath==/id/Firefox-Pranks/,ga:pagePath==/id/Guitar-Hero-LED-Mod/
奇怪的是,这个相同的查询将在本地运行,但在我们的临时服务器上失败,但随后在生产中运行。即使此查询在一个上下文中失败,其他查询在同一上下文中也会正常。我知道这些查询必须是经过身份验证的 HTTP 请求的一部分。这可能是问题所在吗?我在每种情况下都使用相同的 Google 帐户(相同的登录名/密码)发送查询。
I'm sending GData queries to renders traffic charts for users of Instructables.com using the Java GData package. However, this exception is sometimes thrown:
[Line 1, Column 0] Invalid root element, expected (namespace uri:local name) of (http://www.w3.org/2005 Atom:feed), found (:feed
The only mention of this error I can find online is here, but I'm quite certain that our feed URL is properly formed. For example, here is a URL that we might send:
https://www.google.com/analytics/feeds/data?ids=ga:472899&metrics=ga:uniquePageviews&dimensions=ga:date&start-date=2009-10-12&end-date=2009-11-11&filters=ga:pagePath==/id/Inverted_Bookshelf/,ga:pagePath==/id/Munny-Speakers/,ga:pagePath==/id/Zippo-Trick%253a-The-Twilight-Zone/,ga:pagePath==/id/Firefox-Pranks/,ga:pagePath==/id/Guitar-Hero-LED-Mod/
Strangely, this same query will work locally, but fail on our staging server, but then work in production. And even if this query fails in one context, other queries will be fine in that same context. I know that these queries must be part of authenticated HTTP requests. Could this be the issue? I am using the same Google account (same login/password) to send the queries in each case.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阅读错误代码告诉您的内容:它告诉您在 Atom 命名空间中需要一个
feed
元素,但在任何命名空间中都没有看到feed
元素。由于授权失败,这种情况不太可能发生(在这种情况下,Google 至少会发送一个根不是
feed
的错误文档);如果您返回的feed
元素缺少默认命名空间的声明,则更有可能出现这种情况。Read what the error code is telling you: it's telling you it's expecting a
feed
element in the Atom namespace, but seeing afeed
element in no namespace.This is unlikely to arise owing to an authorization failure (Google, at least, sends an error document whose root is not
feed
in that case); it is more likely to arise if thefeed
element you get back lacks a declaration for the default namespace.