收到错误在Android中使用结构查询(SQ)从谷歌小号preadsheet API检索数据 [英] Getting Error in retrieving data from Google Spreadsheet API using Structure Query (sq) in Android

查看:194
本文介绍了收到错误在Android中使用结构查询(SQ)从谷歌小号preadsheet API检索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作与谷歌Android US preadsheet API。我成功地完成与集成和能够检索的行。但面对搜索功能有点问题。我有3-4个不同的搜索而S preadsheet。现在的问题是,在我的小号preadsheet一些列我有字与字之间的空间。

I am working with Google Spreadsheet API in Android. I am successfully done with the integration and able to retrieve the rows. But facing a little problem in search functionality. I am having 3-4 different search for the spreadsheet. The problem is that in my spreadsheet in some columns I am having space between words.

有关如的Hello World是在第5行和该行让头名的值说测试。

For e.g Hello World is a value in row number 5 and the header name for this row is let say test.

所以,当我搜索的Hello World 这是扔的 InValidEntryException:错误的请求

So when i search for the Hello World it is throwing InValidEntryException : Bad Request.

我还与URLEn coder.en code(字符串URL)尝试,并替换20%的空间。但是,没有这项工作对我来说。我知道我得到的,因为空间的错误,但不知道如何解决。试图与这2个东西,但有错误仍在挣扎。

I also try with URLEncoder.encode(String url) and also replace the space with %20. But none of that work for me. I know i am getting the error because of the space but don't know how to resolve. Tried with this 2 things but still struggling with the error.

如果任何人有任何想法,请您帮助。下面是错误日志。

If anyone has any idea please kindly help. Below is the error log.

错误日志: -

10-09 14:26:29.048: I/System.out(1009): URL ==> https://spreadsheets.google.com/feeds/list/tl5vghRJs8_wuVQWnk5TnhA/od6/private/full?sq=streetname=bal%20bay
10-09 14:26:30.327: D/dalvikvm(1009): GC_CONCURRENT freed 439K, 46% free 3492K/6407K, external 920K/1417K, paused 18ms+14ms
10-09 14:26:31.847: I/System.out(1009): Service
10-09 14:26:31.877: W/System.err(1009): com.google.gdata.util.InvalidEntryException: Bad Request
10-09 14:26:31.887: W/System.err(1009): Parse error: null
10-09 14:26:31.967: W/System.err(1009):     at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:602)
10-09 14:26:32.217: W/System.err(1009):     at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
10-09 14:26:32.228: W/System.err(1009):     at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
10-09 14:26:32.228: W/System.err(1009):     at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
10-09 14:26:32.228: W/System.err(1009):     at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
10-09 14:26:32.228: W/System.err(1009):     at com.google.gdata.client.Service.getFeed(Service.java:1135)
10-09 14:26:32.228: W/System.err(1009):     at com.google.gdata.client.Service.getFeed(Service.java:998)
10-09 14:26:32.237: W/System.err(1009):     at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:645)
10-09 14:26:32.259: W/System.err(1009):     at com.google.gdata.client.Service.getFeed(Service.java:1017)
10-09 14:26:32.259: W/System.err(1009):     at com.test.voter.SearchActivity$SearchTask.doInBackground(SearchActivity.java:144)
10-09 14:26:32.259: W/System.err(1009):     at com.test.voter.SearchActivity$SearchTask.doInBackground(SearchActivity.java:1)
10-09 14:26:32.259: W/System.err(1009):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
10-09 14:26:32.278: W/System.err(1009):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
10-09 14:26:32.287: W/System.err(1009):     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
10-09 14:26:32.287: W/System.err(1009):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
10-09 14:26:32.312: W/System.err(1009):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
10-09 14:26:32.312: W/System.err(1009):     at java.lang.Thread.run(Thread.java:1019)

修改

1)URL listFeedUrl = new  URI(worksheet.getListFeedUrl().toString() + "?sq=" + URLEncoder.encode("streetname=\"164Th\"")).toURL(); 

2)URL listFeedUrl = new  URI(worksheet.getListFeedUrl().toString() + "?sq=" + URLEncoder.encode("streetnumber=\"1923\"%20and%20streetname=\"164Th\"")).toURL();

(1)工作完全正常,但是当使用多个参数(2)它不工作,再次给予同样的InvalidEntryException。

(1) Works perfectly fine but when used multiple parameter (2) it does not work, giving the same InvalidEntryException again.

推荐答案

或者你可以搜索问题列表<一href="http://$c$c.google.com/a/google.com/p/apps-api-issues/issues/detail?id=2308&can=1&q=label%3AAPI-S$p$padsheets%20query&colspec=API%20ID%20Type%20Status%20Priority%20Stars%20Opened%20Summary"相对=nofollow>发行2308 并通知注释3:

Or you could search the issues list for issue 2308 and notice comment 3:

如果你只是用引号括起的名字,它工作正常。你甚至可以使用的空间在这里列名。

if you just wrap the name in quotes, it works fine. You can even use spaces in your column names here.

的https://s$p$padsheets.google.com/feeds/ $ {KEY} /记录/ 0?平方=5B+%3D + 3   的https://s$p$padsheets.google.com/feeds/ $ { KEY} /记录/ 0?平方=的+猫+%3D + 3

https://spreadsheets.google.com/feeds/${KEY}/records/0?sq="5B"+%3D+3 https://spreadsheets.google.com/feeds/${KEY}/records/0?sq="the+cat"+%3D+3

...希望什么不是就记录饲料的记载就名单饲料竟是实施,尽管过渡到WontFix状态后。

... and hope that what was not documented in respect of the records feed was actually implemented in respect of the list feed, despite the transition to a 'WontFix' status later.

这篇关于收到错误在Android中使用结构查询(SQ)从谷歌小号preadsheet API检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆