If you are looking for simple library for RSS feeds, than look no further.
Just download ROME library for Java and get RSS feeds inside your Java program in 10 minutes. Just don't forget to put JDOM library inside your CLASSPATH because ROME has dependency on JDOM.
This code sample bellow is really self explanatory. What a great library!
public void getRssFeeds(String rssFeedurl) { URL url = new URL(rssFeedurl); HttpURLConnection httpcon = (HttpURLConnection)url.openConnection(); SyndFeedInput input = new SyndFeedInput(); SyndFeed feed = input.build(new XmlReader(httpcon)); List entries = feed.getEntries(); Iterator<SyndEntry> itEntries = entries.iterator(); while (itEntries.hasNext()) { SyndEntry entry = itEntries.next(); log.info("Title: " + entry.getTitle()); log.info("Link: " + entry.getLink()); log.info("Author: " + entry.getAuthor()); log.info("Publish Date: " + entry.getPublishedDate()); log.info("Description: " + entry.getDescription().getValue()); } }
No comments:
Post a Comment