View RSS Feed

My Java Tips

Reading RSS using Informa API

Rate this Entry
by , 11-28-2011 at 06:56 PM (3334 Views)
RSS (Really Simple Syndication) is a family of Web feed formats used to publish frequently updated content such as blog entries, news headlines, and podcasts. It is actually a specification for XML files to provide syndicated data.

To read RSS feeds in a Java application is easy. You have to use Informa API which is availabel at:

The code snippet given below shows how to read RSS using Informa API.

Java Code:
try {
  URL feed = new URL("file:/C:/samplefeed.rss");
  ChannelFormat format = FormatDetector.getFormat(feed);
  ChannelParserCollection parsers =

  ChannelParserIF parser =
    parsers.getParser(format, feed);

  parser.setBuilder(new ChannelBuilder());
  ChannelIF channel = parser.parse();

  for (Iterator iter = channel.getItems().iterator();
                                     iter.hasNext();) {
    ItemIF item = (ItemIF);
} catch (MalformedURLException mue) {
} catch (UnsupportedFormatException ufe) {
} catch (ParseException pe) {
This given example gets the RSS feed and prints out the news items on the console.

Submit "Reading RSS using Informa API" to Facebook Submit "Reading RSS using Informa API" to Digg Submit "Reading RSS using Informa API" to Submit "Reading RSS using Informa API" to StumbleUpon Submit "Reading RSS using Informa API" to Google

Tags: informa, rss Add / Edit Tags
Java EE