Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing an RSS reader in Java

Tags:

java

xml

rss

I'm trying to write a basic RSS reader for a class project. Our book shows an example by walking the DOM tree. Is that a decent approach for an RSS reader? Would I just ignore certain tags that are of uninterest to me and not to be used by the RSS Reader? Thanks.

like image 443
Crystal Avatar asked Sep 02 '10 16:09

Crystal


People also ask

What is an RSS feed example?

An RSS (Really Simple Syndication) feed is an online file that contains details about every piece of content a site has published. Each time a site publishes a new piece of content, details about that content—including the full-text of the content or a summary, publication date, author, link, etc.


2 Answers

For inspiration you can look at ROME, an open source tool for handling RSS & Atom feeds.

like image 185
Kwebble Avatar answered Oct 12 '22 23:10

Kwebble


It's one of two common approaches, so yes. And yes, ignoring tags that are not of interest is a good way to handle it. If you don't need it, no need to take note of it. If you know in advance exactly what tags you need, you probably don't need to walk the entire DOM tree.

You could also use a SAX parser which would probably be faster and less memory intensive, though probably not necessary in this case, depending on how many results you wish to have in the feed.

like image 29
AHungerArtist Avatar answered Oct 13 '22 00:10

AHungerArtist