tags:

views:

95

answers:

1

I am using Rome to combine several feeds into one. It's largely based on this example on the Rome site.

I'm creating a RSS 2.0 feed, which I save as a (W3C) Document then pass to a stylesheet to convert to HTML.

One of my requirements is to display the source (link to and name of originating site) for each entry (as they can come from a variety of sources).

According to the RSS spec there is a optional source attribute per item. And Rome appears to support this with a setSource method on the SyndEntry interface. However, setting this to the SyndFeed of the original feed doesn't appear to set this attribute.

The document I output doesn't contain a source element in the item.

Any clues on what I might be doing wrong or suggestions on alternative methods for doing what I want to do?

Thanks in advance, Darren.

A: 

I have found a workaround for this for now.

As I only really need to give a name as attribution I am overriding the author field as follows.

SyndEntry entry = // fetched from SyndFeed
Module dcModule = entry.getModule(DCModule.URI);
String title = // My overridden title
if (dcModule != null && title != null) {
    ((DCModule)dcModule).setCreator(title);
}

The reason I use this code instead of SyndEntry.setAuthor is that calling that only sets the author if it's null, we need to always set it to our value.

I then reference this as dc:creator in my XSL stylesheet.

Darren Greaves