Parsing/Reading RSS/Atom Feed Using ROME

Parsing / Reading RSS / Atom Feed Using ROME Tutorial describes about How to parse / read RSS / Atom feed using ROME API.

ROME is an open source java library that contains different utility classes and methods for parsing and publishing syndicated feeds, By using ROME API makes it very easily compliance with most of the RSS / Atom and syndication feeds.

Rome library contains lot of converters to convert from one format to another. Rome will parse any format of News feeds, including RSS variants and Atom

Below you can see an example of ROME API which parses the given google's feed burner link

http://feeds.feedburner.com/javatipsfeed

Rome can support most of the syndication formats includes following

  1. RSS 0.90
  2. RSS 0.91 Netscape
  3. RSS 0.91 Userland
  4. RSS 0.92
  5. RSS 0.93
  6. RSS 0.94
  7. RSS 1.0
  8. RSS 2.0
  9. Atom 0.3
  10. Atom 1.0
Required Libraries

You need to download

  1. OpenJDK 8 / Corretto
  2. ROME (Rome Download)
  3. JDOM

Parsing/Reading RSS/Atom Example

import java.net.URL;
import java.util.Iterator;

import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;

// Parsing/Reading RSS/Atom Feed With ROME API

public class AtomReader {

 
public static void main(String[] args) throws Exception {

   
URL url = new URL("http://feeds.feedburner.com/javatipsfeed");
    XmlReader xmlReader =
null;

   
try {

     
xmlReader = new XmlReader(url);
      SyndFeed feeder =
new SyndFeedInput().build(xmlReader);
      System.out.println
("Title Value " + feeder.getAuthor());

     
for (Iterator iterator = feeder.getEntries().iterator(); iterator
          .hasNext
();) {
       
SyndEntry syndEntry = (SyndEntry) iterator.next();
        System.out.println
(syndEntry.getTitle());
     
}
    }
finally {
     
if (xmlReader != null)
       
xmlReader.close();
   
}
  }
}
Output
fn:join() JSTL Function
HttpSessionListener Example
Ireport Download
JSTL For Example
JSP Redirect Example
Hibernate Session Tutorial
Parsing XML String Using DOM
Sort ArrayList Of Object
Block Jboss Accessible Only From Localhost
Tomcat Download
fn:substringAfter() JSTL Function
JSP Forward Example
fn:length() JSTL Function
Display Tag Library Tutorial
Hibernate Mapping Example

 











Your email address will not be published. Required fields are marked *