使用JAVA rss4j包制作RSS文件

来源:互联网 发布:双达书店淘宝店 编辑:程序博客网 时间:2024/05/27 00:32
使用JAVA rss4j包制作RSS文件
作者 冷月宫主 发表于 2004-10-12 18:42:30
================================================
=下载:http://www.churchillobjects.com/soft/rss4j/rss4j092.jar
================================================
=浏览:http://www.churchillobjects.com/c/13005.html
================================================
=需求:http://xml.apache.org/xerces2-j/index.html
================================================
安装:1解压 rss4j092包,获得rss4j.jar拷贝到{your wwwrooo}/WEB-INF/lib/
2解压在xerces2-j下的zip包,把里面的几个JAR文件拷贝到{your wwwrooo}/WEB-INF/lib/

<cfscript>doc=createObject("java","churchillobjects.rss4j.RssDocument");doc.setVersion(doc.VERSION_10);// create and add a new channelchannel =createObject("java","churchillobjects.rss4j.RssChannel"); channel.setChannelTitle("ChurchillObjects.com Features");channel.setChannelLink("http://www.churchillobjects.com");channel.setChannelDescription("Advanced Object-Oriented Developer Resource");channel.setChannelUri("http://www.churchillobjects.com/rss/");doc.addChannel(channel);// create and add two itemsitem1 = createObject("java","churchillobjects.rss4j.RssChannelItem"); item1.setItemTitle("Networking Apps With Redenzvous");item1.setItemLink("http://www.churchillobjects.com/c/11028.html");item1.setItemDescription("Avoid the difficulties of internetworked applications with this fast, robust framework package.");channel.addItem(item1);item2 = createObject("java","churchillobjects.rss4j.RssChannelItem"); item2.setItemTitle("Secure Sockets with JSSE & OpenSSL");item2.setItemLink("http://www.churchillobjects.com/c/11201.html");item2.setItemDescription("Find out how to implement robust secure communnications between your clients and servers, including making your own certificate authority.");channel.addItem(item2);// create and add an image for the channelimg = createObject("java","churchillobjects.rss4j.RssChannelImage");img.setImageLink("http://www.churchillobjects.com");img.setImageUrl("http://www.churchillobjects.com/i/co.gif");img.setImageTitle("ChurchillObjects.com");channel.setChannelImage(img);rfile=createObject("java","java.io.File");rfile.init(JavaCast('string', "c:/rss.xml"));RssGenerator=createObject("java","churchillobjects.rss4j.generator.RssGenerator");</cfscript><cftry>  <cfset RssGenerator.generateRss(doc, rfile)>  成功  <cfcatch type="any">  出错  </cfcatch></cftry>
原创粉丝点击