问题
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.
回答1:
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 .
回答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" />
来源:https://stackoverflow.com/questions/18112949/atomlink-in-rss-using-rome