一 RSS介绍
RSS(Rich Site Summary丰富站点摘要或者Really Simple Syndication),是一种用于共享新闻标题和其他Web内容的XML格式标准,同时也是在互联网上被广泛采用的内容包装和投递协议。网络用户可以在客户端借助于支持RSS的新闻聚合工具软件,在不打开网站内容页面的情况下阅读支持RSS输出的网站内容。
内容提供者在其网站上发布相应的RSS文件,入口程序获取该RSS文件并把它提供给用户,用户使用相应的阅读程序来阅读该内容。 <channel>
<title><!-- channel 的标题 --></title>
<description><!-- 简要描述 --></description>
<link><!-- channel 的 URL --></link>
<!-- 可选/可扩展元素 -->
<item>
<title><!-- 项标题 --></title>
<link><!-- 项 URL --></link>
<description><!-- 简要描述 --></description>
<!-- 可选的/可扩展的元素 -->
</item>
</channel>
FeedDemon、看天下网络资讯浏览器 、新浪点点通阅读器、周博通等是常见的RSS阅读器。
二 RSS的历史版本:
http://blogs.law.harvard.edu/tech/rssVersionHistory
RSS的版本有很多个,0.90、0.91、0.92、0.93、0.94、1.0
国内主要是RSS2.0,国外主要用ATOM0.3.
三 RSS
1:例子:
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>The channel's name goes here</title>
<link>http://www.urlofthechannel.com/</link>
<description>This channel is an example channel for an article.
</description>
<language>en-us</language>
<image>
<title>The image title goes here</title>
<url>http://www.urlofthechannel.com/images/logo.gif</url>
<link>http://www.urlofthechannel.com/</link>
</image>
<item>
<title>The Future of content</title>
<link>http://www.itworld.com/nl/ecom_in_act/11122003/</link>
<description> The issue of people distributing and reusing
digital media is a problem for many businesses. It may also be
a hidden opportunity. Just as open source licensing has opened
up new possibilities in the world of technology, it promises to do
the same in the area of creative content.</description>
</item>
<item>
<title>Online Music Services - Better than free?</title>
<link>http://www.itworld.com/nl/ecom_in_act/08202003/</link>
<description>More people than ever are downloading music from
the Internet. Many use person-to-person file sharing programs like
Kazaa to share and download music in MP3 format, paying nothing.
This has made it difficult for companies to setup online music
businesses. How can companies compete against free?</description>
</item>
</channel>
</rss>
2:RSS文件由一个
还以项的形式包含表示频道元数据的元素
项通常是频道的主要部分,包含经常变化的内容。
频道一般有三个元素,提供关于频道本身的信息:
<title>:频道或提要的名称。
<link>:与该频道关联的
<description>:简要介绍该频道是做什么的。
许多频道子元素都是可选的。常用的
<url>:表示该频道的
<title>:图象的描述。当频道以
<link>:站点的
<image>
<width>:数字,表示图象的像素宽度,最大值是
<height>:数字,表示图象的像素高度。最大值是
<description>:包含文本,在呈现时可以作为围绕着该图像形成的链接元素的
此外还可以使用许多其他可选的频道元素。多数都是不言自明的:
4:摘要(feed)用<item>表示,<item>的格式如下:
每个摘要通常包含三个元素:
<title>:这是项的名称,在标准应用中被转换成
<link>:这是该项的
<description>:通常作为
所有的元素都是可选的,但是一个项至少要么
项还有其他一些可选的元素:
<author>:作者的
<category>:支持有组织的记录。
<comments>:关于项的注释页的
<enclosure>:支持和该项有关的媒体对象。
<guid>:唯一与该项联系在一起的永久性链接。
<pubDate>:该项是什么时候发布的。
<source>:该项来自哪个
。