Atom:link in RSS using Rome

无人久伴 提交于 2019-12-19 09:46:58

问题


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

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