亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

rsslibj

系統 1618 0
RSS是一個標準的XML文件,Rss閱讀器可以讀取這個XML文件獲得文章的信息,使用戶可以通過Rss閱讀器
而非瀏覽器閱讀Blog,我們只要動態生成這個XML文件便可以了。RSSLibJ是一個專門讀取和生成RSS的小
巧實用的Java庫,大小僅25k,可以從 http://sourceforge.net/projects/rsslibj/ 下載rsslibj-

1_0RC2.jar和它需要的EXMLjar兩個文件,然后復制到web/WEB-INF/lib/下。
?
?

下載下來之后把 擴張名.zip 改為 .jar 就行了。

Java代碼 復制代碼
  1. import ?com.rsslibj.elements.Channel; ??
  2. public ? class ?Writer?{ ??
  3. ???? public ? static ? void ?main(String[]?args)? ??
  4. ???????????? throws ?InstantiationException,?ClassNotFoundException,? ??
  5. ????????????IllegalAccessException?{ ??
  6. ????????Channel?channel= new ?Channel(); ??
  7. ????????channel.setDescription( "This?is?my?sample?channel." ); ??
  8. ????????channel.setLink( "http://localhost/" ); ??
  9. ????????channel.setTitle( "My?Channel" ); ??
  10. ????????channel.setImage( "http://localhost/" ,? ??
  11. ???????????????? "The?Channel?Image" ,? ??
  12. ???????????????? "http://localhost/foo.jpg" ); ??
  13. ????????channel.setTextInput( "http://localhost/search" ,? ??
  14. ???????????????? "Search?The?Channel?Image" ,? ??
  15. ???????????????? "The?Channel?Image" ,? ??
  16. ???????????????? "s" ); ??
  17. ????????channel.addItem( "http://localhost/item1" , ??
  18. ???????????????? "The?First?Item?covers?details?on?the?first?item>" , ??
  19. ???????????????? "The?First?Item" ) ??
  20. ????????????????.setDcContributor( "Joseph?B.?Ottinger" ); ??
  21. ????????channel.addItem( "http://localhost/item2" , ??
  22. ???????????????? "The?Second?Item?covers?details?on?the?second?item" , ??
  23. ???????????????? "The?Second?Item" ) ??
  24. ????????????????.setDcCreator( "Jason?Bell" ); ??
  25. ????????System.out.println( "The?feed?in?RDF:?" +channel.getFeed( "rss" )); ??
  26. ????} ??
  27. }??
Java代碼 復制代碼
  1. import ?com.rsslibj.elements.Channel; ??
  2. public ? class ?Writer?{ ??
  3. ???? public ? static ? void ?main(String[]?args)? ??
  4. ???????????? throws ?InstantiationException,?ClassNotFoundException,? ??
  5. ????????????IllegalAccessException?{ ??
  6. ????????Channel?channel= new ?Channel(); ??
  7. ????????channel.setDescription( "This?is?my?sample?channel." ); ??
  8. ????????channel.setLink( "http://localhost/" ); ??
  9. ????????channel.setTitle( "My?Channel" ); ??
  10. ????????channel.setImage( "http://localhost/" ,? ??
  11. ???????????????? "The?Channel?Image" ,? ??
  12. ???????????????? "http://localhost/foo.jpg" ); ??
  13. ????????channel.setTextInput( "http://localhost/search" ,? ??
  14. ???????????????? "Search?The?Channel?Image" ,? ??
  15. ???????????????? "The?Channel?Image" ,? ??
  16. ???????????????? "s" ); ??
  17. ????????channel.addItem( "http://localhost/item1" , ??
  18. ???????????????? "The?First?Item?covers?details?on?the?first?item>" , ??
  19. ???????????????? "The?First?Item" ) ??
  20. ????????????????.setDcContributor( "Joseph?B.?Ottinger" ); ??
  21. ????????channel.addItem( "http://localhost/item2" , ??
  22. ???????????????? "The?Second?Item?covers?details?on?the?second?item" , ??
  23. ???????????????? "The?Second?Item" ) ??
  24. ????????????????.setDcCreator( "Jason?Bell" ); ??
  25. ????????System.out.println( "The?feed?in?RDF:?" +channel.getFeed( "rss" )); ??
  26. ????} ??
  27. }??
      import com.rsslibj.elements.Channel;
public class Writer {
    public static void main(String[] args) 
            throws InstantiationException, ClassNotFoundException, 
            IllegalAccessException {
        Channel channel=new Channel();
        channel.setDescription("This is my sample channel.");
        channel.setLink("http://localhost/");
        channel.setTitle("My Channel");
        channel.setImage("http://localhost/", 
                "The Channel Image", 
                "http://localhost/foo.jpg");
        channel.setTextInput("http://localhost/search", 
                "Search The Channel Image", 
                "The Channel Image", 
                "s");
        channel.addItem("http://localhost/item1",
                "The First Item covers details on the first item>",
                "The First Item")
                .setDcContributor("Joseph B. Ottinger");
        channel.addItem("http://localhost/item2",
                "The Second Item covers details on the second item",
                "The Second Item")
                .setDcCreator("Jason Bell");
        System.out.println("The feed in RDF: "+channel.getFeed("rss"));
    }
}

    
?
Java代碼 復制代碼
  1. Channel?channel?=? new ?Channel();? ??
  2. channel.setDescription(account.getDescription());? ??
  3. baseUrl?=?baseUrl.substring( 0 ,?n);? ??
  4. channel.setLink( "http://server-name/home.c?accountId=" ?+?accountId);? ??
  5. channel.setTitle(account.getTitle());? ??
  6. List?articles?=?facade.getArticles(accountId,?account.getMaxPerPage(),? 1 );? ??
  7. Iterator?it?=?articles.iterator();? ??
  8. while (it.hasNext())?{? ??
  9. ????Article?article?=?(Article)it.next();? ??
  10. ????channel.addItem( "http://server-name/article.c?articleId=" ?+?article.getArticleId(),? ??
  11. ????????article.getSummary(),?article.getTitle()? ??
  12. ????);? ??
  13. }? ??
  14. //?輸出xml:? ??
  15. response.setContentType( "text/xml" );? ??
  16. PrintWriter?pw?=?response.getWriter();? ??
  17. pw.print(channel.getFeed( "rss" ));? ??
  18. pw.close();???
Java代碼 復制代碼
  1. Channel?channel?=? new ?Channel();? ??
  2. channel.setDescription(account.getDescription());? ??
  3. baseUrl?=?baseUrl.substring( 0 ,?n);? ??
  4. channel.setLink( "http://server-name/home.c?accountId=" ?+?accountId);? ??
  5. channel.setTitle(account.getTitle());? ??
  6. List?articles?=?facade.getArticles(accountId,?account.getMaxPerPage(),? 1 );? ??
  7. Iterator?it?=?articles.iterator();? ??
  8. while (it.hasNext())?{? ??
  9. ????Article?article?=?(Article)it.next();? ??
  10. ????channel.addItem( "http://server-name/article.c?articleId=" ?+?article.getArticleId(),? ??
  11. ????????article.getSummary(),?article.getTitle()? ??
  12. ????);? ??
  13. }? ??
  14. //?輸出xml:? ??
  15. response.setContentType( "text/xml" );? ??
  16. PrintWriter?pw?=?response.getWriter();? ??
  17. pw.print(channel.getFeed( "rss" ));? ??
  18. pw.close();???
      Channel channel = new Channel(); 
channel.setDescription(account.getDescription()); 
baseUrl = baseUrl.substring(0, n); 
channel.setLink("http://server-name/home.c?accountId=" + accountId); 
channel.setTitle(account.getTitle()); 
List articles = facade.getArticles(accountId, account.getMaxPerPage(), 1); 
Iterator it = articles.iterator(); 
while(it.hasNext()) { 
    Article article = (Article)it.next(); 
    channel.addItem("http://server-name/article.c?articleId=" + article.getArticleId(), 
        article.getSummary(), article.getTitle() 
    ); 
} 
// 輸出xml: 
response.setContentType("text/xml"); 
PrintWriter pw = response.getWriter(); 
pw.print(channel.getFeed("rss")); 
pw.close(); 

    
?
Java代碼 復制代碼
  1. import ?com.rsslibj.elements.Channel; ??
  2. ??
  3. public ?classWriter{ ??
  4. ???? public ? static ? void ?main(String[]?args)? ??
  5. ???????? throws ?InstantiationException,ClassNotFoundException,IllegalAccessException?{ ??
  6. ???????? ??
  7. ????????Channel?channel?=? new ?Channel(); ??
  8. ????????channel.setDescription( "Thisismysamplechannel." ); ??
  9. ????????channel.setLink( "/" ); ??
  10. ????????channel.setTitle( "MyChannel" ); ??
  11. ????????channel.setImage( "/" ,? "TheChannelImage" ,? "/foo.jpg" ); ??
  12. ????????channel.setTextInput( "/search" ,? "SearchTheChannelImage" ,? "TheChannelImage" ,? "s" ); ??
  13. ????????channel.addItem( "/item1" ,? "TheFirstItemcoversdetailsonthefirstitem>" ,? ??
  14. ???????????????? "TheFirstItem" ).setDcContributor( "JosephB.Ottinger" ); ??
  15. ????????channel.addItem( "/item2" ,? "TheSecondItemcoversdetailsontheseconditem" , ??
  16. ???????????????? "TheSecondItem" ).setDcCreator( "JasonBell" ); ??
  17. ????????System.out.println( "ThefeedinRDF:" ?channel.getFeed( "rdf" )); ??
  18. ????} ??
  19. }??

rsslibj


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 国产a免费 | 精品一区二区三区在线视频 | 久操热| 色综合久久久久久久久久久 | 国产精品免费视频一区一 | 日韩综合久久 | 99这里都是精品 | 国产精彩视频在线 | 国产自精品在线 | 12至16末成年毛片 | 午夜亚洲国产精品福利 | 中国老妇色xxxxx | 日日噜噜噜夜夜爽爽狠狠 | 国产亚洲精aa在线观看不卡 | 精品免费在线视频 | 日本中文在线观看 | 97影院九七理论片男女高清 | 老子影院午夜伦手机在线看 | 97视频在线观看免费播放 | 欧美亚洲综合在线观看 | 在线观看日本一区 | 91视频香蕉 | 日日狠日| 2018天天操 | 成年ssswww中国女人 | 婷婷 色天使 | 久久久亚洲国产精品主播 | 久久中文字幕网 | 91视频网页版 | 欧美福利精品福利视频在线观看 | 午夜成人在线视频 | 欧洲美女a视频一级毛片 | 在线观看视频一区二区 | 国产亚洲一级精品久久 | 国产成人精品视频一区二区不卡 | 国内视频自拍 | 亚洲人成激情在线播放 | a级片日韩 | 99热这里有免费国内精品 | 四虎永久网址影院 | 亚洲久草 |