Question

I try to create a rss Feed with Rome which has enclosures (for a podcast). So I create an entry with

SyndEntry entry = new SyndEntryImpl();

After I set the basic information of the entry (like Title and Link), I want to set an enclosure with the media file.

SyndEnclosure enclosure = new SyndEnclosureImpl();
enclosure.setType("audio/mpeg");
enclosure.setUrl(enclosureURL);
enclosure.setLength(123456);
List<SyndEnclosure> enList = new ArrayList<SyndEnclosure>();
enList.add(enclosure);
entry.setEnclosures(enList);

But when I output the RSS file with

File cacheFile = new File(filename);
SyndFeedOutput output = new SyndFeedOutput();
FileWriter writer;
try {
    writer = new FileWriter(cacheFile);
    output.output(feed, writer);
}

The enclosures do not appear in the RSS file.

Was it helpful?

Solution

I found my error. My SyndFeed was an RSS 1.0 Feed which apperently does not support enclosures. With RSS 2.0 it works well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top