how to parse news rss feeds?

553 views
Skip to first unread message

kumar

unread,
Aug 3, 2010, 3:28:40 PM8/3/10
to Google Web Toolkit
how to parse news rss feeds?
RSS feed like any of news sites or google news... please help me

lineman78

unread,
Aug 4, 2010, 11:50:42 AM8/4/10
to Google Web Toolkit
The easiest, but not most efficient way would be to write a server
side proxy to fetch for you and use the built-in GWT DOM parsing API.

http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/xml/client/XMLParser.html

The most efficient method that I would use is to use the RSS XSD to
generate JAXB classes which will be used in the proxy to parse the RSS
and convert it into JSON so it can be parsed faster on the client. I
would also add a server-side cache so multiple clients viewing the
same RSS feed aren't making multiple requests per minute, cacheing for
1 minute would be sufficient I think.

kumar

unread,
Aug 4, 2010, 12:12:00 PM8/4/10
to Google Web Toolkit

Hi lineman,

Thanks for giving me response, my problem is not the parsing.. problem
is parsing from public server feeds which will provide news.
I have tried with RequestBuilder class but i unable to read data from
other servers (Ex. Google news feed, yahoo news feed etc..).. data
coming as null.. I have searched on the google but i have't find any
solutions..

Thanks
Please provide information about parsing from other servers
On Aug 4, 8:50 am, lineman78 <linema...@gmail.com> wrote:
> The easiest, but not most efficient way would be to write a server
> side proxy to fetch for you and use the built-in GWT DOM parsing API.
>
> http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/g...

Joe Hudson

unread,
Aug 4, 2010, 2:32:56 PM8/4/10
to Google Web Toolkit

lineman78

unread,
Aug 4, 2010, 3:33:27 PM8/4/10
to Google Web Toolkit
The problem you are having is related to the Same Origin Policy(SOP)
within the browser. It basically says that code can only load data
from the server it is loaded from. That is why I suggested the server
side proxy in both solutions above. Unfortunately this means the
server is making the request for you, so any personalized RSS feeds or
ones that require authentication will not be accessible. If you would
like to avoid writing your own proxy you can try using YQL for JSONP:

http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D'http%3A%2F%2Frss.news.yahoo.com%2Frss%2Ftopstories'&format=json&callback=cbfunc
Reply all
Reply to author
Forward
0 new messages