使用 ROME 创建 Atom feed 并发布它们
我是这个发布/订阅协议的新手。抱歉,如果我的问题很天真。 你能帮助我回答我的问题吗? 我开始使用 ROME API 创建一个 Atom feed其 wiki 上给出的示例。
SyndFeed feed = new SyndFeedImpl();
feed.setFeedType("atom_1.0");
feed.setTitle("Sample Feed (created with ROME)");
feed.setLink("http://www.example.com");
feed.setDescription("This feed has been created using ROME";
List entries = new ArrayList();
SyndEntry entry;
SyndContent description;
entry = new SyndEntryImpl();
entry.setTitle("ROME v1.0");
entry.setLink("http://wiki.java.net/bin/view/Javawsxml/Rome01");
entry.setPublishedDate(DATE_PARSER.parse("2010-04-09"));
description = new SyndContentImpl();
description.setType("text/plain");
description.setValue("Initial release of ROME");
entry.setDescription(description);
entries.add(entry);
feed.setEntries(entries);
我将其写入文件atomfeed.xml。标签中默认的 rel 属性是 。如何使用 SyndFeed 或 SyndEntry 的 setLink() 方法设置不同的相对属性?
我应该如何将此atomfeed.xml feed发布到网络上(而不是任何博客上)。我可以在我的public_html文件夹中创建一个目录,然后在我的URL中使用该目录发布它吗?这是正确的做法吗?每次我想添加新条目时,我可以更新它并继续在网络上发布它吗?
发布者客户端与发布者有何不同?
感谢您的时间和帮助
I am a newbie to this pub/sub protocol. Sorry if my questions are very naive.
Could you help me by answering my questions.
I started off creating an atom feed using ROME API looking at the example given on its wiki.
SyndFeed feed = new SyndFeedImpl();
feed.setFeedType("atom_1.0");
feed.setTitle("Sample Feed (created with ROME)");
feed.setLink("http://www.example.com");
feed.setDescription("This feed has been created using ROME";
List entries = new ArrayList();
SyndEntry entry;
SyndContent description;
entry = new SyndEntryImpl();
entry.setTitle("ROME v1.0");
entry.setLink("http://wiki.java.net/bin/view/Javawsxml/Rome01");
entry.setPublishedDate(DATE_PARSER.parse("2010-04-09"));
description = new SyndContentImpl();
description.setType("text/plain");
description.setValue("Initial release of ROME");
entry.setDescription(description);
entries.add(entry);
feed.setEntries(entries);
I am writing this into a file atomfeed.xml. The default rel-attribute in the tag is . How do I set different rel-attributes using this SyndFeed's or SyndEntry's setLink() method ?
How should I publish this atomfeed.xml feed onto the web(not on any blog).Can I create a directory in my public_html folder and just publish it with that dir in my URL ? Is this the correct way of doing it ? And every time I want to add a new entry can I just update this and keep publishing it on the web ?
How is Publisher Client different from Publisher ?
Thanks for your time and help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以创建一个 SyndLink,例如
然后在您的条目上设置
然后对于多个链接,创建 SyndLinks 列表并使用 setLinks(list) 在条目上设置。
http://www.jarvana.com/jarvana/view/net/java/dev/rome/rome/1.0.0/rome-1.0.0-javadoc。 jar!/com/sun/syndicate/feed/synd/SyndLink.html
You can make a SyndLink, eg
Then on your entry set that
Then for multiple links, create a List of SyndLinks and set on the entry with setLinks(list).
http://www.jarvana.com/jarvana/view/net/java/dev/rome/rome/1.0.0/rome-1.0.0-javadoc.jar!/com/sun/syndication/feed/synd/SyndLink.html
应该这样实现:
Should be realized like this: