Jose Sandoval Google
 Resume     Book     Software     Drawings     Home     Subscribe to RSS feed Search Web Search josesandoval.com

GWT client + RSS Feed Reader + Code
Friday, July 13, 2007

I've received a few emails asking me for the code of a small program I wrote on February: a GWT UI that reads multiple RSS feeds simultaneously.

The code can be found here: sandoval.ca/gwt.

I think what most people are interested in is the actual RSS reader. That functionality can be found in the file RSSServiceImpl.java. This is the important part of the code:

...

import org.gnu.stealthp.rsslib.RSSHandler;
import org.gnu.stealthp.rsslib.RSSItem;
import org.gnu.stealthp.rsslib.RSSParser;

...

RSSHandler handler = new RSSHandler();
URL rssURL = new URL(url);
RSSParser.parseXmlFile(rssURL, handler, false);

LinkedList list = handler.getRSSChannel().getItems();
int listSize = list.size();
listSize = (listSize > 10) ? 10 : listSize;
for (int i = 0; i < listSize; i++) {
...
RSSItem item = (RSSItem) list.get(i);

// Getting stuff out of the RSSItems
item.getLink();
item.getDescription();
item.getTitle();
theLink.toString();
}

...

Before writing it, I researched a couple of RSS Java APIs, but I liked rsslib4j. I found it the quickest to code with.

BTW, if you download all the code and play around with the application, you'll find that digg's RSS feed doesn't work. I'm not sure why, but I think they have blocked my client; maybe they check which reader is parsing their XML file. If it works for you, let me know.


10:35 AM | 0 comment(s) |

Comments:


This page is powered by Blogger. Isn't yours?

Guestbook
© Jose Sandoval 2004-2009 jose@josesandoval.com