views:

103

answers:

1

I want to parse the results of a public google reader feed of mine. I am writing an app in gwt and up to this point I had been following an example with the line:

String gdata = 
    "http://www.google.com/base/feeds/snippets?alt=json-in-script&callback=";

The feed is retrieved,

public void handle(JavaScriptObject jso) {
    JSONObject json = new JSONObject(jso);
    JSONArray ary = json.get("feed").isObject().get("entry").isArray();
    Window.alert(json.toString());
}

and the data is displayed on the panel + i see it in the alert window. However, when I change the url so that I can use my feed rather than an example, nothing works.

Here are some of the ways I've tried to format my url:

http://www.google.com/reader/public/javascript/feed/http://www.google.com/reader/public/atom/user%2F17524205173321155204%2Flabel%2Fpub?alt=json-in-script&callback=
http://www.google.com/reader/public/javascript/feed/http://www.google.com/reader/public/atom/user%2F11035509885961399965%2Fstate%2Fcom.google%2Fbroadcast?callback=?
http://www.google.com/reader/public/javascript/feed/http://www.google.com/reader/public/atom/user%2F11035509885961399965%2Fstate%2Fcom.google%2Fbroadcast?callback=?

Ostensibly the feeds are the same except for the example one that works has all the text on a single long line where the others have whitespace. Could this be causing an issue? What can I do to get around it?

I want to run regular expressions against the data im getting back from the feed. is there a better way to do this?

Thank you very much!

A: 

The sample is an url for the Google Base http://www.google.com/base/api/demo/html/demo.html product, while what you are trying to do is for the Google Reader product, which uses a different return format of the data. I'm not familiar with both formats, but from what I see, you probably should forget about the base format and see how the reader data is formatted.

Furthermore. The Base api (the example you use) seems to automatically inserts the callback method name (I conclude from your example), so it might be you need to change the url and append: callback=gdata.io.handleScriptLoaded to make it work in the first place.

Hilbrand