我查了下网上发现了一些,但是不知道哪个RSS包好用而且还相对比较小。RSSLibJ倒是小,但是发现已经没人维护了,连网站都访问不到了。
麻烦谁给我介绍个小而强大的Java读取RSS的包。谢谢

解决方案 »

  1.   

    1.RSS标准RSS标准比较混乱,主要有以下3个系列 RSS 0.9x / 2.0 : RSS技术诞生于1999年的网景公司(Netscape),其发布了一个0.9版本的规范。2001年,RSS技术标准的发展工作被Userland Software公司的戴夫 温那(Dave Winer)所接手。陆续发布了0.9x的系列版本。当W3C小组发布RSS 1.0后,Dave Winer不承认其有效性。并于2002年9月独自把RSS升级到了2.0版本(Really Simple Syndication),并交由哈佛大学Technology at Harvard Law进行维护。 
    RSS 1.0 : 在RSS发展过程中,为使RSS成为一个通用的规范,并进一步标准化。一个联合小组根据W3C新一代的Resource Description Framework  (RDF) 对RSS进行了重新定义,发布了RSS 1.0版,并把RSS定义为“RDF Site Summary”。现在RSS 1.0版由W3C联合小组维护。 
    Atom : Atom是一个项目的名字,主要是开发一个新的博客摘要格式以解决目前RSS存在的问题(混乱的版本号,不是一个真正的开放标准,表示方法的不一致,定义贫乏等等)。 
     2.如何实现RSSRSS标准虽然混乱,但是其本质都是XML文档。你可以只使用notepad, 按照某个RSS标准, 手写一个xml, 并提供给客户端。现在也有许多开源项目来提供RSS的解决方案。Rome https://rome.dev.java.net/RSSLibJ http://enigmastation.com/rsslibj/RSSLib4J http://devzone.stealthp.org/cms/index.php?page=RSSLib4J使用这些解决方案可以更方便的处理RSS.3.用 Rome 实现 RSS 服务目前Rome最新版本为rome-0.9. 本例是在Struts的Action中实现的RSS服务. 新建一个RssAction
      

  2.   

    import other classes...    
    import com.sun.syndication.feed.synd.SyndFeed;    
    import com.sun.syndication.io.SyndFeedOutput;    
       
    public class RssAction extends DispatchAction {    
       
        private static final String MIME_TYPE = "application/xml; charset=UTF-8";    
            
        // Rome中RSS的可选标准    
        // rss_0.90, rss_0.91, rss_0.92, rss_0.93, rss_0.94, rss_1.0, rss_2.0, atom_0.3     
        private static final String RSS_TYPE = "rss_2.0";    
       
        public ActionForward newsFeed(ActionMapping mapping,    
                ActionForm form, HttpServletRequest request,    
                HttpServletResponse response) throws Exception {    
            NewsFeedBA newsFeedBA = new NewsFeedBA();    
            newsFeedBA.doExecute();    
            outputRssFeed(response, newsFeedBA.getFeed());    
            return null;    
        }    
       
        public ActionForward blogFeed(ActionMapping mapping,    
                ActionForm form, HttpServletRequest request,    
                HttpServletResponse response) throws Exception {    
            String uid = request.getParameter("userId");    
            BlogFeedBA blogFeedBA = new BlogFeedBA();    
            blogFeedBA.setUserId(uid);    
            blogFeedBA.doExecute();    
            outputRssFeed(response, blogFeedBA.getFeed());    
            return null;    
        }    
            
        //将SyndFeed写入HttpServletResponse    
        private boolean outputRssFeed(HttpServletResponse response, SyndFeed feed) {    
            boolean result = false;    
            feed.setFeedType(RSS_TYPE);    
            response.setContentType(MIME_TYPE);    
            SyndFeedOutput output = new SyndFeedOutput();    
            try {    
                output.output(feed, response.getWriter());    
                result = true;    
            } catch (IOException e) {    
                e.printStackTrace();    
            } catch (FeedException e) {    
                e.printStackTrace();    
            }    
            return result;    
        }    
    }   
      

  3.   

    建议使用 rssutils 他提供了 rssutils.jar 包 有意向的可以加我 910787572