Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 编程语言 > Java > 学以致用:写一个属于自己的Rss
【标  题】:学以致用:写一个属于自己的Rss
【关键字】:Rss
【来  源】:网络

学以致用:写一个属于自己的Rss

Your Ad Here

    今天看到系统发来的短消息,采用RSS订阅每个类别最新文档。我查了下资料,发现有个rsslibj的开源工具可以帮助我们写自己的rss文档。当然,我这里讲的是java的实现。

  首先去下载个rsslibj的包:[点击这里]

  参考官方网站的例子程序

 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("rdf"));
    }
}

  开始怀疑中文会有问题(老外的软件),测试了一下居然很好,什么问题也没有。你要是熟悉rss文档格式,很容易编写一个标准的rss的writer出来。

经验分享:开发SWT应用两点心得:【上一篇】
Java进阶:JNI使用技巧点滴:【下一篇】
【相关文章】
没有相关文章
【随机文章】
  • 如何保护笔记本电脑的屏幕?
  • LMDS系统可用性前瞻
  • 心情
  • 简单IP路由
  • 测试你的杀毒软件是不是垃圾
  • Painter 界面定制(1)
  • 轻松配置vsftp :-)
  • dereferencing pointer to incomplete type
  • 鹦鹉螺0.5 介绍
  • AbeStore集群配置(Windows平台、阵列方式)
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.