Atom:link in RSS using Rome

荒凉一梦 提交于 2019-12-01 09:41:36

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 .

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" />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!