Feeds and Java

my contribution at http://mansourk.blogspot.com/ now here:

Since i got impressed how simple this was in python (thanks for this wonderful module), i got curious if there are libs in java and how simple they are. I found rome and commons feedparser (dont even look for a jar to download, just via svn and selfcompiling). Two nice libs, but both with a different approach of feedhandling. rome uses a dom and commons feedparser a sax like handling of the feed. But have a look at some really simple example for both.

rome:
The relevant code part

URL feedUrl = new URL("http://feeds.feedburner.com/RumblingsOfAFrustratedProgrammer");

SyndFeedInput input = new SyndFeedInput();  
SyndFeed feed = input.build(new XmlReader(feedUrl));  
for (Iterator iter = feed.getEntries().iterator(); iter.hasNext();) {  
  SyndEntry element = (SyndEntry) iter.next();  
  printEntry(element);  
}

printEntry just prints some part of the entry and was implemented by myself.

commons feedparser:

FeedParser parser = FeedParserFactory.newFeedParser();  
FeedParserListener listener = new DefaultFeedParserListener() {

   public void onItemEnd() throws FeedParserException {  
       super.onItemEnd();  
       System.out.println("article end");  
   }

   public void onChannel(FeedParserState state, String title, String link,  
                         String description) throws FeedParserException {

       System.out.println("Found a new channel: " + title);  
   }

   public void onItem(FeedParserState state, String title, String link,   
                  String description, String permalink)   
                   throws FeedParserException {  
       System.out.println(title);  
       System.out.println(description);  
       System.out.println(link);  
   }

   public void onCreated(FeedParserState state, Date date) throws FeedParserException {  
       System.out.println("Which was created on: " + date);  
   }

};

String resource = "http://feeds.feedburner.com/RumblingsOfAFrustratedProgrammer";  
ResourceRequest request = ResourceRequestFactory.getResourceRequest(resource);  
InputStream is = request.getInputStream();  
parser.parse(listener, is, resource);

Now you just need to know what to do with those feeds. Maybe i am gonna write my "feeds to xhtml page" stuff with all 3 libs for comparison and post it here.