rss轮询展示
来源:互联网 发布:国内开源php erp 编辑:程序博客网 时间:2024/05/16 07:10
Rss对返回的xml格式有一套严格的规定,详细模板见附件;
一般java读取xml
URL url = new URL(rss);
//读取Rss源
XmlReader reader = new XmlReader(url);
System.out.println("Rss源的编码格式为:" + reader.getEncoding());
SyndFeedInput input =new SyndFeedInput();
//得到SyndFeed对象,即得到Rss源里的所有信息
// SyndFeed feed =input.build(reader);
SyndFeed feed = input.build(new InputSource(url.openStream()));
//System.out.println(feed);
//得到Rss新闻中子项列表
List entries =feed.getEntries();
Entries格式:
SyndEntryImpl.contents[0].interface=interfacecom.sun.syndication.feed.synd.SyndContent
SyndEntryImpl.contents[0].type=html
SyndEntryImpl.contents[0].mode=null
SyndEntryImpl.updatedDate=null
SyndEntryImpl.link=http://iyanlei.com/java_titan.html
SyndEntryImpl.foreignMarkup[0]=[Element:<slash:comments [Namespace: http://purl.org/rss/1.0/modules/slash/]/>]
SyndEntryImpl.foreignMarkup[1]=[Element:<wfw:commentRss [Namespace: http://wellformedweb.org/CommentAPI/]/>]
SyndEntryImpl.links=[]
SyndEntryImpl.interface=interfacecom.sun.syndication.feed.synd.SyndEntry
SyndEntryImpl.uri=http://iyanlei.com/java_titan.html
SyndEntryImpl.enclosures=[]
SyndEntryImpl.titleEx.value=Java操作图数据库Titan
SyndEntryImpl.titleEx.interface=interfacecom.sun.syndication.feed.synd.SyndContent
SyndEntryImpl.titleEx.type=null
SyndEntryImpl.titleEx.mode=null
SyndEntryImpl.author=Ray
SyndEntryImpl.authors=[]
SyndEntryImpl.title=Java操作图数据库Titan
SyndEntryImpl.source=null
SyndEntryImpl.description.value=Titan简介Titan是一个分布式的图形数据库,特别为存储和处理大规模图形而优化。支持不同的分布式存储层Cassandra 1.1HBase 0.92内置实现 Blueprints grap...
SyndEntryImpl.description.interface=interfacecom.sun.syndication.feed.synd.SyndContent
SyndEntryImpl.description.type=text/html
SyndEntryImpl.description.mode=null
SyndEntryImpl.categories=[]
SyndEntryImpl.publishedDate=TueMay 19 15:55:08 CST 2015
SyndEntryImpl.wireEntry=null
SyndEntryImpl.modules[0].publishers=[]
SyndEntryImpl.modules[0].identifiers=[]
SyndEntryImpl.modules[0].subjects=[]
SyndEntryImpl.modules[0].coverages=[]
SyndEntryImpl.modules[0].subject=null
SyndEntryImpl.modules[0].rights=null
SyndEntryImpl.modules[0].date=TueMay 19 15:55:08 CST 2015
SyndEntryImpl.modules[0].type=null
SyndEntryImpl.modules[0].descriptions=[]
SyndEntryImpl.modules[0].sources=[]
SyndEntryImpl.modules[0].publisher=null
SyndEntryImpl.modules[0].creator=Ray
SyndEntryImpl.modules[0].formats=[]
SyndEntryImpl.modules[0].languages=[]
SyndEntryImpl.modules[0].title=null
SyndEntryImpl.modules[0].dates[0]=TueMay 19 15:55:08 CST 2015
SyndEntryImpl.modules[0].contributor=null
SyndEntryImpl.modules[0].description=null
SyndEntryImpl.modules[0].types=[]
SyndEntryImpl.modules[0].contributors=[]
SyndEntryImpl.modules[0].relation=null
SyndEntryImpl.modules[0].format=null
SyndEntryImpl.modules[0].interface=interfacecom.sun.syndication.feed.module.DCModule
SyndEntryImpl.modules[0].uri=http://purl.org/dc/elements/1.1/
SyndEntryImpl.modules[0].creators[0]=Ray
SyndEntryImpl.modules[0].source=null
SyndEntryImpl.modules[0].coverage=null
SyndEntryImpl.modules[0].relations=[]
SyndEntryImpl.modules[0].titles=[]
SyndEntryImpl.modules[0].rightsList=[]
SyndEntryImpl.modules[0].language=null
SyndEntryImpl.modules[0].identifier=null
System.out.println("标题:" + entry.getTitle());
System.out.println("连接地址:" + entry.getLink());
SyndContentdescription = entry.getDescription(); System.out.println("标题简介:" + description.getValue());
System.out.println("发布时间:" + entry.getPublishedDate());
//以下是Rss源可先的几个部分
System.out.println("标题的作者:" + entry.getAuthor());
标题:Java操作图数据库Titan
连接地址:http://iyanlei.com/java_titan.html
标题简介:Titan简介Titan是一个分布式的图形数据库,特别为存储和处理大规模图形而优化。支持不同的分布式存储层Cassandra 1.1HBase 0.92内置实现 Blueprints grap...
发布时间:Tue May 19 15:55:08 CST 2015
标题的作者:Ray
- rss轮询展示
- RSS
- RSS
- rss
- RSS
- RSS
- RSS
- rss
- Rss
- rss
- RSS
- rss
- RSS
- RSS?
- RSS
- rss
- RSS?
- RSS
- java 按行遍历比按列遍历快,打印多维数组
- 机器能做的事你就别凑热闹了╮(︶﹏︶")╭
- 查看端口占用
- 用JavaScript在网页上显示时间,并可暂停和开始
- 每日一学(九)Android动画---Tween动画的代码实现
- rss轮询展示
- 网络编程基础知识(同步、异步、堵塞、非堵塞)
- flexbox(上)
- Javascript学习笔记 基础(一)
- 进程间通信 之 消息队列(Linux)
- 【0009】navicat11.1安装破解教程
- 指针与数组
- 日语语法(七):连词
- lintcode--摊平嵌套的列表