« Latest links | Main | Java SE 6 too »

ROME 0.9 (beta) is available

A new release of the RSS and Atom Utilities (ROME) project ROME 0.9 (beta) is now available on the project's Java.net website. This new release includes fixes to Atom relative URI resolution, easier parsing for RSS feeds that use <content:encoded>, better support for mapping of RSS to and from Atom and numerous small fixes. Here are some quick links to the relevant release docs and files.

Let's review a couple of the changes that might affect the ways you use ROME, starting with the RSS parsing changes.

Easier parsing of RSS feeds that use <content:encoded>

Now that ROME includes built-in support for <content:encoded>, most user will no longer need to download and configure the separate and optional Content Module plugin. That's important because many RSS feeds use <description> as item summary and <content:encoded> as item content. It's also important because Atom supports both entry <summary> and <content>. So, whether you are parsing RSS or Atom the code to get an RSS item or Atom entry summary and content is the same. To this this, we made a number of small changes:

  • Added a new com.sun.syndication.feed.rss.Content object to the RSS model
  • Added code to converters to convert RSS Content to SyndEntry Content and vice-versa
  • Added code to generate <content:encoded> if content is present

Here's a simple example that shows how to parse and print out parts of an RSS feed with entries that have both summary and content (using ROME's SyndFeed model):

    String urlstring = "http://scripting.wordpress.com/feed/";
    InputStream is = new URL(urlstring).openConnection().getInputStream();
    SyndFeedInput input = new SyndFeedInput();
    SyndFeed feed = (SyndFeed)input.build(
        new InputStreamReader(is, Charset.forName("UTF-8")));

    Iterator entries = feed.getEntries().iterator();
    while (entries.hasNext()) {
        SyndEntry entry = (SyndEntry)entries.next();
        System.out.println("Title: " + entry.getTitle());
        System.out.println("Published: " + entry.getPublishedDate());
        if (entry.getDescription() != null) {
            System.out.println("Description: "
               + entry.getDescription().getValue());
       if (entry.getContents().size() > 0) {
           SyndContent content = (SyndContent)entry.getContents().get(0);
           System.out.println("Content type=" + content.getType());
           System.out.println("Content value=" + content.getValue());

That certainly makes things easier in most cases, but if you need full support for all of the features defined by the Content Module specification you can still download and use ROME's Content Module plugin -- it works exactly as it did before.

Better mapping for mapping Atom and RSS

As ROME users already know, ROME supports parsing feeds to three different object models the RSS model, the Atom model and "SyndFeed" -- an abstract model that you can use when you do not care about the source format of the feed. ROME includes converters to convert to and from the different models. We made two changes to improve the mapping done by the converters. First, as you saw above, we added support for Content to our RSS model. That allows us to map Atom summary/content nicely to and from RSS description/content, like so:

RSS <description>     <--> SyndEntry.description <--> Atom <summary>
RSS <content:encoded> <--> SyndEntry.contents[0] <--> Atom <content>

Second, we added better support for Atom title and subtitles. In the old ROME, there was some potential for information loss because the SyndFeed model did not completely support the Atom model. Specifically, titles and subtitles did not support a type attribute. To fix that without breaking the API (i.e. ensuring that old ROME code still compiles and works), we added a number of new methods to make the type information available by returning title and description as SyndContent objects (which have type and value properties).

SyndFeed additions:

  • public SyndContent getTitleEx()
  • public void setTitleEx(SyndContent title)
  • public SyndContent getDescriptionEx()
  • public void setDescriptionEx(SyndContent desc)


  • public SyndContent getTitleEx()
  • public void setTitleEx(SyndContent title)

We left the existing getters and setters in place, so your existing code will continue to compile and work properly. And that's it for the quick review...

What's next?

Download it, try it out, report bugs and give the ROME project some feedback and support. And what's next for ROME? I think ROME is just about ready for a 1.0 release, but there's one last feature we need to add: some form of feed security to strip potentially malicious JavaScript from feeds. Then onto ROME2.

For even more information on ROME...

There's a complete chapter on ROME in my recently published book RSS and Atom in Action.


Congratulations and thanks for leading this release Dave. P@

Posted by Patrick Chanezon on December 14, 2006 at 09:45 PM EST #

Is it somehow possible to skip encoding in content:encode in order to allow tags?

Posted by George Safe on August 05, 2008 at 04:59 PM EDT #


I am using Rome to generate rss feeds and I think it is fantastic.

But I have one problem that I have spent ages on:

How to add <[CDATA[...]]> around html.

I have seen references to ContentModule and I have downloaded it and played around with it to no avail.

I have seen example code showing how to read a content encoded feed but none to write one.

I am just hoping (and praying) that you may be able to help me with a simple example of using the ContentModule to enclose html with CDATA (if that is in fact what it is for).



Posted by Lyndon on January 16, 2010 at 05:48 PM EST #

Post a Comment:
  • HTML Syntax: NOT allowed

« Latest links | Main | Java SE 6 too »


This is just one entry in the weblog Blogging Roller. You may want to visit the main page of the weblog

Related entries

Below are the most recent entries in the category Java, some may be related to this entry.