开发者

Android RSS reader

开发者 https://www.devze.com 2023-02-04 22:49 出处:网络
I\'m trying to develop an Android RSS Reader. I would like to use android.sax to read some information from a rss but I\'m not sure how to do it. I n开发者_如何转开发eed a tutorial about android.sax o

I'm trying to develop an Android RSS Reader. I would like to use android.sax to read some information from a rss but I'm not sure how to do it. I n开发者_如何转开发eed a tutorial about android.sax or some example about it. Can somebody help me please?


I think that this is exactly what you are looking for. It is an article about working with XML in Android on IBM developerWorks. The example shows how to parse a RSS XML response.


It's fairly easy to setup an implementation of a SAX parser but the hard part is to be able to parse any and every feed under the sun.

You need to cater to all formats RSS 1, RSS 2, Atom etc. Even then you will have to contend with poorly formatted feeds.

I had faced similar problems in the past so decided to do my feed parsing on a server and just get the parsed contents. This allows me to run more complex libraries and parser which I can modify without pushing out updates for my app.

I have the following service running on AppEngine which allows for a much simpler XML / JSON parsing at your end. There is a fixed and simple structure to the response. You can use this for parsing

http://evecal.appspot.com/feedParser

You can send both POST and GET requests with the following parameters.

feedLink : The URL of the RSS feed response : JSON or XML as the response format

Examples:

For a POST request

curl --data-urlencode "feedLink=http://feeds.bbci.co.uk/news/world/rss.xml" --data-urlencode "response=json" http://evecal.appspot.com/feedParser

For GET request

evecal.appspot.com/feedParser?feedLink=http://feeds.nytimes.com/nyt/rss/HomePage&response=xml

My android app "NewsSpeak" uses this too.

0

精彩评论

暂无评论...
验证码 换一张
取 消