RSSpect - About

Rsspect is a pure java implimentation of the RSS news syndication format. It is a well designed and easy to use news feed library that integrates nicely with other software. It's written in pure java and can be easily integrated with other parts of your existing or new web application.


  • A Java Runtime (version 5 or above).
  • An application to make use of the library.


  • Add the rsspect-<version>.jar to the java classpath.
  • For a maven project, add the rsspect library as a maven dependency to your project.


  • Available in the maven central repository. Source hosted as a git repository at Browse Source Code
  • It comes with an intuitive, developer-friendly API javadoc.
  • All objects in the library are serializable, immutable and thread-safe.
  • Minimal dependencies. Atomsphere only requires a stax-api implementation to work. So if you are on java 6 there are no dependencies needed.
  • In the spirit of Open Source Software, Atomsphere is licensed with the terms of the Apache License, Version 2.0.


  • Read a file from disk into an RSS bean.
    RSS myRSS = new RSSDoc().readRSSToBean(new File("/myPath/myRSS.xml");
  • Read a file from the web into an RSS bean.
    RSS myRSS = new RSSDoc().readRSSToBean(new URL("");
  • Read an RSS bean into a String.
    String myRssStr = myRSS.toString();
  • Read an RSS bean into a formatted String.
    String myRssStr = new RSSDoc().readRSSToString(myRSS, "javanet.staxutils.IndentingXMLStreamWriter");
  • Write an RSS bean to disk.
    new RSSDoc().writeRSSDoc(new File("/somewhere/myRSS.xml"), myRSS, "UTF-8", "1.0");
  • Write a formatted RSS bean to disk.
    new RSSDoc().writeRSSDoc(new javanet.staxutils.IndentingXMLStreamWriter( XMLOutputFactory.newInstance().createXMLStreamWriter( new FileOutputStream("/somewhere/myRSS.xml"), "UTF-8")), myRSS, "UTF-8", "1.0");
  • A CRUD example
    public class CrudExample {
     public static void main(String[] args) {
      try {
       RSSDoc rssDoc = new RSSDoc();
       // make sure title or description is present for item
       Title title = rssDoc.buildTitle("my title");
       Description description = rssDoc.buildDescription("my description");
       Item item = rssDoc.buildItem(title, null, description, null, null,
         null, null, null, null, null, null);
       // title, link and description are required for channel
       // we add pubDate and items because these are usually there
       Link link = rssDoc
       List<Item> items = new ArrayList<Item>();
       PubDate pubDate = rssDoc.buildPubDate(Calendar.getInstance()
       Channel channel = rssDoc.buildChannel(title, link, description,
         null, null, null, null, pubDate,
         null, null, null, null, null, null,
         null, null, null, null, null, null,
       //rss element require channel and version attribue
       Attribute rssVersion = rssDoc.buildAttribute("version","2.0");
       List<Attribute> attributes = new ArrayList<Attribute>();
       RSS rss = rssDoc.buildRSS(channel, attributes, null);
       System.out.println("rss 1 : "+rss);
       rssDoc.writeRSSDoc(new File("out1.xml"), rss, rssDoc.getEncoding(),rssDoc.getXmlVersion());
       RSS newRSS = rssDoc.readRSSToBean(new File("out1.xml"));
       System.out.println("newRSS 1 : "+newRSS);
       //should print false
       System.out.println("1) rss equal newRSS? "+rss.equals(newRSS));
       //add the missing generator to rss
       channel = rssDoc.buildChannel(channel.getTitle(), channel.getLink(), channel.getDescription(),
         null, null, null, null, channel.getPubDate(),
         null, null, rssDoc.getLibVersion(), null, null, null,
         null, null, null, null, null, null,
       rss = rssDoc.buildRSS(channel, attributes, null);
       System.out.println("rss 2 : "+rss);
       //should print true
       System.out.println("2) rss equal newRSS? "+rss.equals(newRSS));
       //make an update
       Attribute xmlns = rssDoc.buildAttribute("xmlns:html","");
       attributes = new ArrayList<Attribute>();
       Extension extension = rssDoc.buildExtension("html:html", attributes,
       "<html:head><html:title>web markup</html:title></html:head><html:body><html:h1>Hello Web.</html:h1></html:body>");
       List<Extension> extensions = new ArrayList<Extension>();
       newRSS = rssDoc.buildRSS(channel, attributes, extensions); 
       System.out.println("newRSS 2 : "+newRSS);
       //should print false
       System.out.println("3) rss equal newRSS? "+rss.equals(newRSS));
       //should still be able to write to file
       rssDoc.writeRSSDoc(new File("out2.xml"), newRSS, rssDoc.getEncoding(),rssDoc.getXmlVersion());
       //delete the extension
       attributes = new ArrayList<Attribute>();
       newRSS = rssDoc.buildRSS(channel, attributes, null);
       System.out.println("newRSS 3 : "+newRSS);
       //should print true
       System.out.println("4) rss equal newRSS? "+rss.equals(newRSS));
       //another way to write the feed to file
       BufferedWriter out = new BufferedWriter(new FileWriter("out3.xml"));
       //another way to consume xml into a bean
       newRSS = rssDoc.readRSSToBean(rss.toString());
       System.out.println("newRSS 4 : "+newRSS);
       //should print true
       System.out.println("5) rss equal newRSS? "+rss.equals(newRSS));
      } catch (Exception e) {
       System.out.println("error with feed: " + e.getMessage());

See Also

  • Visit the brother project Atomsphere for using Atom 1.0 feeds.