`
fanjava
  • 浏览: 229091 次
  • 来自: ...
文章分类
社区版块
存档分类
最新评论

写自己的rss

阅读更多
采用RSS订阅每个类别最新文档
我查了下资料,发现有个rsslibj的开源工具可以帮助我们写自己的rss文档
当然,我这里讲的是java的实现。
首先去下载个rsslibj的包:
http://sourceforge.net/project/showfiles.php?group_id=71153
参考官方网站的例子程序
importcom.rsslibj.elements.Channel;
publicclassWriter{
publicstaticvoidmain(String[]args)
throwsInstantiationException,ClassNotFoundException,
IllegalAccessException{
Channelchannel=newChannel();
channel.setDescription("Thisismysamplechannel.");
channel.setLink("http://localhost/");
channel.setTitle("MyChannel");
channel.setImage("http://localhost/",
"TheChannelImage",
"http://localhost/foo.jpg");
channel.setTextInput("http://localhost/search",
"SearchTheChannelImage",
"TheChannelImage",
"s");
channel.addItem("http://localhost/item1",
"TheFirstItemcoversdetailsonthefirstitem>",
"TheFirstItem")
.setDcContributor("JosephB.Ottinger");
channel.addItem("http://localhost/item2",
"TheSecondItemcoversdetailsontheseconditem",
"TheSecondItem")
.setDcCreator("JasonBell");
System.out.println("ThefeedinRDF:"+channel.getFeed("rdf"));
}
}
开始怀疑中文会有问题(老外的软件),测试了一下居然很好,什么问题也没有。
你要是熟悉rss文档格式,很容易编写一个标准的rss的writer出来

参考:rsslibj的主页http://enigmastation.com/rsslibj/
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics