---
title: "写自己的rss"
author: "fanjava"
date: "2004-10-18T14:37:00Z"
tags: []
slug: "rss"
draft: false
lastmod: "2004-10-18T14:37:00Z"
id: 601823
url: "https://fanjava.iteye.com/blog/601823"
---

采用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&gt;",  
"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/