5

It is recommended to add to RSS 2.0.

I am wondering if there is any Rome module available to add this tag? Like what they developed for content, media, etc.

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
Afshin Moazami
  • 2,092
  • 5
  • 33
  • 55

2 Answers2

6

The blog post Adding Atom links to an RSS feed generated by ROME answers exactly that question:

there is no build-in immediate support for Atom elements inside an RSS feed ... I’ve implemented an AtomContent class that holds a list of com.sun.syndication.feed.atom.Link but is easy extensible.

The code is published as https://github.com/michael-simons/java-syndication .

Joe
  • 29,416
  • 12
  • 68
  • 88
  • 1
    Here's also a working example, that is live at my JUGs website: https://github.com/EuregJUG-Maas-Rhine/site/blob/master/src/main/java/eu/euregjug/site/web/IndexRssView.java Cheers. – Michael Simons Sep 06 '16 at 19:46
2

It's not a module, but you can use Channel.getForeignMarkup() if you want to add simple elements to your Channel.

org.jdom2.Element atomLink = new Element("link", org.jdom2.Namespace.getNamespace("atom", "http://www.w3.org/2005/Atom"));
atomLink.setAttribute("href", "http://dallas.example.com/rss.xml");
atomLink.setAttribute("rel", "self");
atomLink.setAttribute("type", "application/rss+xml");

channel.getForeignMarkup().add(atomLink);
<atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://dallas.example.com/rss.xml" rel="self" type="application/rss+xml" />
Ben Hutchison
  • 4,823
  • 4
  • 26
  • 25
  • After a lot of looking around and trying some solutions that involve creating a Rome module. (none of which I had success with) I tried this little block of code and it worked. Well, I should say it worked enough that the RSS Feed validator no longer returns an error – AwkDenver Aug 09 '23 at 18:26