Dave Johnson on open web technologies, social software and Java
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:
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/";
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 <--> 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).
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...
For even more information on ROME...
There's a complete chapter on ROME in my recently published book RSS and Atom in Action.
This is just one entry in the weblog Blogging Roller. You may want to visit the main page of the weblog
Below are the most recent entries in the category Java, some may be related to this entry.