views:

66

answers:

3

Hello everyone What would be the easiest way to parse an rss feed? Are there any already done easy(fast to implement) methods out there? All the posts I could find on the topic were many years old. Any new technologies out there that are worthy of attention? Or should I just make my own parser?

Edit: please link to a usage method/tutorial too :)

+1  A: 

For just reading it out, you can use DOM parser, which is very simple to use and to understand. And: It is part of the android API

poeschlorn
Checking it...Any tutorials/examples about DOM?
Tamas
try this out: Once it was my guide for dom. by the way it is about parsing RSS ;-)http://www.brics.dk/~amoeller/XML/programming/domexample.html
poeschlorn
Please comment your code, if you post it somewhere. At the first and second look, I have no idea what does what or where or why. :)
Tamas
sry, this is not my own code ;-) The main issue is, to create a multipath tree and read out the nodes...this is basically what this code above does
poeschlorn
"Once it was my guide..." Sorry, I misread :)My issues is time, I don't want to waste time, on something that has already been done before. But it looks like, there is no real easy to use method out there.
Tamas
+2  A: 

For bigger XML i would recomend a serial XML parser like SAX - it's build in: http://developer.android.com/reference/android/sax/package-summary.html

For examples just search in Google - there are milions out there: http://www.google.at/search?q=sax+android+tutorial

Mannaz
Yeah but I can't find an easy one. My dream would be a rssparser.jar with a rssparser.seturi(), rssparser.readresponse() methods. :D
Tamas
What about this one: http://www.anddev.org/parsing_xml_from_the_net_-_using_the_saxparser-t353.htmlIt is well structured and quite that, what you'r looking for.
Mannaz
We choose the saxparser method, thanks for the tip!It was a lot easier to understand, than the other methods.
Tamas
A: 

You can take the source code from Android XML Parser Performance as an example. I stick to SAXParser though XmlPullParser is good as well.
DOM is not the best option for a memory-constrained device (unless you want to manipulate the tree which you don't).

alex
<uses-sdk android:minSdkVersion="2"></uses-sdk>what a dinosaur :Dchecking it...
Tamas