Atom:使用罗马链接RSS

建议添加到RSS 2.0。

我想知道是否有任何罗马模块可以添加此标签? 就像他们为内容,媒体等开发的那样 。

博客文章添加Atom链接到ROME生成的RSS源正好回答了这个问题:

RSS源中的Atom元素没有内置的立即支持…我已经实现了一个包含com.sun.syndication.feed.atom.Link列表的AtomContent类,但是很容易扩展。

代码发布为https://github.com/michael-simons/java-syndication 。

它不是一个模块,但是如果要向Channel添加简单元素,可以使用Channel.getForeignMarkup()

 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);