Rss2.0格式[转]

Rss2.0格式[转]

转的太多了,实在找不到最早是谁写的了。这里感谢下原创的作者吧。

<?xml version="1.0" ?>
<rss version="2.0">
    
<channel>
        
<!--Required Elements Begin-->
        
<title>
            
<!--The name of the channel.-->
            
<!--It's how people refer to your service.-->
            
<!--If you have an HTML website that contains the same information as your RSS file, the title of your channel should be the same as the title of your website.-->
            
<!--[Example:GoUpstate.com News Headlines]-->
        
</title>
        
<link>
            
<!--The URL to the HTML website corresponding to the channel.-->
            
<!--[Example:http://www.goupstate.com/]-->
        
</link>
        
<description>
            
<!--Phrase or sentence describing the channel.-->
            
<!--[Example:The latest news from GoUpstate.com, a Spartanburg Herald-Journal Web site.]-->
        
</description>
        
<!--Required Elements End-->
        
<!--Optional Elements Begin-->
        
<language>
            
<!--The language the channel is written in.-->
            
<!--This allows aggregators to group all Italian language sites, for example, on a single page. A list of allowable values for this element, as provided by Netscape, is here.-->
            
<!--You may also use values defined by the W3C.-->
            
<!--[Example:en-us]-->
        
</language>
        
<copyright>
            
<!--Copyright notice for content in the channel.-->
            
<!--[Example:Copyright 2002, Spartanburg Herald-Journal]-->
        
</copyright>
        
<managingEditor>
            
<!--Email address for person responsible for editorial content.-->
            
<!--[Example:geo@herald.com (George Matesky)]-->
        
</managingEditor>
        
<webMaster>
            
<!--Email address for person responsible for technical issues relating to channel.-->
            
<!--[Example:betty@herald.com (Betty Guernsey)]-->
        
</webMaster>
        
<pubDate>
            
<!--The publication date for the content in the channel.-->
            
<!--For example, the New York Times publishes on a daily basis, the publication date flips once every 24 hours.-->
            
<!--That's when the pubDate of the channel changes.-->
            
<!--All date-times in RSS conform to the Date and Time Specification of RFC 822, with the exception that the year may be expressed with two characters or four characters (four preferred).-->
            
<!--[Example:Sat, 07 Sep 2002 00:00:01 GMT]-->
        
</pubDate>
        
<lastBuildDate>
            
<!--The last time the content of the channel changed.-->
            
<!--[Example:Sat, 07 Sep 2002 09:42:31 GMT]-->
        
</lastBuildDate>
        
<category>
            
<!--one or more categories that the channel belongs to.-->
            
<!--Follows the same rules as the <item>-level category element.-->
            
<!--[Example:<category>Newspapers</category>]-->
        
</category>
        
<generator>
            
<!--A string indicating the program used to generate the channel.-->
            
<!--[Example:MightyInHouse Content System v2.3]-->
        
</generator>
        
<docs>
            
<!--A URL that points to the documentation for the format used in the RSS file.-->
            
<!--It's probably a pointer to this page.-->
            
<!--It's for people who might stumble across an RSS file on a Web server 25 years from now and wonder what it is.-->
            
<!--[Example:http://blogs.law.harvard.edu/tech/rss]-->
        
</docs>
        
<cloud>
            
<!--processes to register with a cloud to be notified of updates to the channel, implementing a lightweight publish-subscribe protocol for RSS feeds.-->
            
<!--[Example:<cloud domain="rpc.sys.com" port="80" path="/RPC2" registerProcedure="pingMe" protocol="soap"/>]-->
            
<!--It specifies a web service that supports the rssCloud interface which can be implemented in HTTP-POST, XML-RPC or SOAP 1.1.-->
            
<!--Its purpose is to allow processes to register with a cloud to be notified of updates to the channel, implementing a lightweight publish-subscribe protocol for RSS feeds.-->
            
<!--<cloud domain="rpc.sys.com" port="80" path="/RPC2" registerProcedure="myCloud.rssPleaseNotify" protocol="xml-rpc" />-->
            
<!--In this example, to request notification on the channel it appears in, you would send an XML-RPC message to rpc.sys.com on port 80, with a path of /RPC2. The procedure to call is myCloud.rssPleaseNotify.-->
        
</cloud>
        
<ttl>
            
<!--ttl stands for time to live.-->
            
<!--It's a number of minutes that indicates how long a channel can be cached before refreshing from the source.-->
            
<!--[Example:<ttl>60</ttl>]-->
        
</ttl>
        
<image>
            
<!--Required Elements Of <image> Begin-->
            
<!--a GIF, JPEG or PNG image that can be displayed with the channel.-->
            
<url>
                
<!--is the URL of a GIF, JPEG or PNG image that represents the channel.-->
            
</url>
            
<title>
                
<!--describes the image, it's used in the ALT attribute of the HTML <img> tag when the channel is rendered in HTML.-->
            
</title>
            
<link>
                
<!--is the URL of the site, when the channel is rendered, the image is a link to the site. (Note, in practice the image <title> and <link> should have the same value as the channel's <title> and <link>.-->
            
</link>
            
<!--Required Elements Of <image> End-->
            
<!--Optional Elements Of <image> Begin-->
            
<width>
                
<!--Maximum value for width is 144, default value is 88.-->
            
</width>
            
<height>
                
<!--Maximum value for height is 400, default value is 31.-->
            
</height>
            
<!--Optional Elements Of <image> End-->
        
</image>
        
<rating>
            
<!--The PICS rating for the channel.]-->
        
</rating>
        
<textInput>
            
<!--Specifies a text input box that can be displayed with the channel.-->
            
<!--The purpose of the <textInput> element is something of a mystery.-->
            
<!--You can use it to specify a search engine box. Or to allow a reader to provide feedback.-->
            
<!--Most aggregators ignore it.-->
            
<!--Required Elements Of <textInput> Begin-->
            
<title>
                
<!--The label of the Submit button in the text input area.-->
            
</title>
            
<description>
                
<!--Explains the text input area.-->
            
</description>
            
<name>
                
<!--The name of the text object in the text input area.-->
            
</name>
            
<link>
                
<!--The URL of the CGI script that processes text input requests.-->
            
</link>
            
<!--Required Elements Of <textInput> End-->
        
</textInput>
        
<skipHours>
            
<!--A hint for aggregators telling them which hours they can skip.-->
        
</skipHours>
        
<skipDays>
            
<!--A hint for aggregators telling them which days they can skip.-->
        
</skipDays>
        
<!--Optional Elements End-->
        
<item>
            
<!--Optional Elements Of <item> Begin-->
            
<title>
                
<!--The title of the item.-->
                
<!--[Example:Venice Film Festival Tries to Quit Sinking]-->
            
</title>
            
<link>
                
<!--The URL of the item.-->
                
<!--[Example:http://nytimes.com/2004/12/07FEST.html]-->
            
</link>
            
<description>
                
<!--The item synopsis.-->
                
<!--[Example:Some of the most heated chatter at the Venice Film Festival this week was about the way that the arrival of the stars at the Palazzo del Cinema was being staged.]-->
            
</description>
            
<author>
                
<!--Email address of the author of the item.-->
                
<!--It's the email address of the author of the item.-->
                
<!--For newspapers and magazines syndicating via RSS, the author is the person who wrote the article that the <item> describes.-->
                
<!--For collaborative weblogs, the author of the item might be different from the managing editor or webmaster.-->
                
<!--For a weblog authored by a single individual it would make sense to omit the <author> element.-->
                
<!--<author>lawyer@boyer.net (Lawyer Boyer)</author>-->
            
</author>
            
<category domain="optional, identifies a categorization taxonomy.">
                
<!--Includes the item in one or more categories.-->
                
<!--It has one optional attribute, domain, a string that identifies a categorization taxonomy.-->
                
<!--<category>Grateful Dead</category>-->
                
<!--<category domain="http://www.fool.com/cusips">MSFT</category>-->
            
</category>
            
<comments>
                
<!--URL of a page for comments relating to the item.-->
                
<!--If present, it is the url of the comments page for the item.-->
                
<!--<comments>http://ekzemplo.com/entry/4403/comments</comments>-->
            
</comments>
            
<enclosure url="where the enclosure is located, The url must be an http url." length="how big it is in bytes" type="what its type is, a standard MIME type">
                
<!--Describes a media object that is attached to the item.-->
                
<!--<enclosure url="http://www.scripting.com/mp3s/weatherReportSuite.mp3" length="12216320" type="audio/mpeg" />-->
                
<!--It has three required attributes.-->
                
<!--url says where the enclosure is located,-->
                
<!--length says how big it is in bytes,-->
                
<!--and type says what its type is, a standard MIME type.-->
            
</enclosure>
            
<guid isPermaLink="optional, true(default) or false">
                
<!--A string that uniquely identifies the item.-->
                
<!--guid stands for globally unique identifier.-->
                
<!--It's a string that uniquely identifies the item.-->
                
<!--When present, an aggregator may choose to use this string to determine if an item is new.-->
                
<!--<guid>http://some.server.com/weblogItem3207</guid>-->
                
<!--If the guid element has an attribute named "isPermaLink" with a value of true, the reader may assume that it is a permalink to the item, that is, a url that can be opened in a Web browser, that points to the full item described by the <item> element. An example:-->
                
<!--<guid isPermaLink="true">http://inessential.com/2002/09/01.php#a2</guid>-->
            
</guid>
            
<pubDate>
                
<!--Indicates when the item was published.-->
                
<!--Its value is a date, indicating when the item was published.-->
                
<!--If it's a date in the future, aggregators may choose to not display the item until that date.-->
                
<!--<pubDate>Sun, 19 May 2002 15:21:36 GMT</pubDate>-->
            
</pubDate>
            
<source url="required attribute, url, which links to the XMLization of the source.">
                
<!--The RSS channel that the item came from.-->
                
<!--<source url="http://www.tomalak.org/links2.xml">Tomalak's Realm</source>-->
                
<!--The purpose of this element is to propagate credit for links, to publicize the sources of news items. It can be used in the Post command of an aggregator.-->
                
<!--should be generated automatically when forwarding an item from an aggregator to a weblog authoring tool.-->
            
</source>
            
<!--Optional Elements Of <item> End-->
        
</item>
    
</channel>
</rss>

  什么是RSS?

    RSS是一种网页内容联合格式(web content sydication format)。
    它的名字是Really Simple Syndication的缩写。
    RSS是XML的一种。所有的RSS文档都遵循XML 1.0规范,该规范发布在W3C网站上。
    
    在一个RSS文档的开头是一个<rss>节点和一个规定的属性version,该属性规定了该文档将以RSS的哪个版本表示。如果该文档以这个规范来表示,那么它的version属性就必须等于2.0。
    
    在<rss>节点的下一级是一个独立的<channel>节点,该节点包含关于channel的信息和内容。
    
  关于本文档

    该文档是在2002年秋天撰写的,当时的RSS版本为2.0.1。
    它包含从RSS 0.91规范(2000年)开始的所有的修改和添加,以及包含在RSS 0.92(2000年12月)和RSS 0.94(2002年8月)中的新的特性。

  必需的频道节点

    下面有一份必须包含的频道(channel)节点的列表,每一个都有一个简单的描述、一个例子、应该出现的位置和更详细描述的超链接。

元素 描述 范例
title 频道(channel)名称。它可以告诉别人如何访问你的服务。如果你有一个与你的RSS文件内容一致的HTML网站,你的title元素值应该与你的网站的标题相同。 GoUpstate.com News Headings
link 响应该频道的网站的URL http://www.goupstate.com/
description 关于该频道的描述 The latest news from GoUpstate.com, a Spartanburg Herald-Joural Web Site

  可选的频道元素

    下面是可选的频道元素列表

节点 描述 范例
language  使用的语言。这允许聚合器对所有的意大利语站点分组。 en-us
copyright 版权声明  Copyright 2002, Spartanburg Herald-Journal
managingEditor 内容负责人的Email geo@herald.com (George Matesky)
webMaster 技术人员的Email betty@herald.com (Betty Guernsey)
pubDate 内容的发布时间 Sat, 07 Sep 2002 00:00:01 GMT
lastBuildDate 最后更新时间 Sat, 07 Sep 2002 09:42:31 GMT
category 指定该频道所属的一个或多个分类。遵循与item级category元素相同的规则。 <category>Newspapers</category>
generator 生成该频道的程序名称 MightyInHouse Content System v2.3
docs 指向rss格式文档的url地址? http://blogs.law.harvard.edu/tech/rss
cloud 允许所有进程注册一个cloud用于获得频道的更新通知,并为rss种子实现一个轻量级的发布订阅协议。 <cloud domain="rpc.sys.com" port="80" path="/RPC2" registerProcedure="pingMe" protocol="soap"/>
ttl ttl是Time to live的缩写。它指示cache的有效保存时间。 <ttl>60</ttl>
image 与频道一起显示的图片地址
rating 该频道的统计图片地址
textInput 指定一个textbox与该频道一起显示
skipHours 告诉使用者哪些时段是可以忽略的
skipDays 告诉使用着哪些天是可以忽略的

  <channel>子节点<image>

<image>是一个可选的<channel>子节点,该节点包含三个必需的子元素和三个可选的子元素。
<url>是GIF、JPEG或PNG图像文件的URL地址,该图像代表整个频道
<title>用于描述上面的图像,等同于HTML语言中的<img>的alt属性
<link>是要连接的站点的url,当显示频道时,图像的连接指向该站点。
<title>和<link>应该与频道的<title>和<link>有相同的值
可选的节点包括<width>和<height>,它们是数字类型,指定图像的宽度和高度,单位为像素
<description>就是link的TITLE属性中文本,它将在调用网页时显示出来。

图像宽度的最大值为144,默认值为88
图像高度的最大值为400,默认值为31

  <channel>子节点<cloud>

  <cloud>是一个可选的<channel>子节点。

  它指定一个可以支持rssCloud接口的web服务,rssCloud接口可以用HTTP-POST,XML-RPC或SOAP1.1实现。

  它的目的是允许通知注册为cloud的进程频道被更新,从而实现一个轻量级的发布订阅协议。

<cloud domain="rpc.sys.com" port="80" path="/RPC2" registerProcedure= "myCloud.rssPleaseNotify" protocol="xml-rpc" />

  在这个例子中,为了请求频道通知,你需要发送一个XML-RPC消息到rpc.sys.com的80端口,路径为/RPC2。调用的过程为myCloud.rssPleaseNotify。

<channel>子节点<ttl>
<ttl>是一个可选的<channel>子节点。
ttl是time to live的缩写。它表示频道在被刷新前应该被缓存的时间。这使得rss源可以被一个支持文件共享的网络所管理,例如Gnutella
例如:<ttl>60</ttl>

<channel>子节点<textInput>
<textInput>是<channel>的可选的子节点,<textInput>包含四个子节点。
<title>--提交按钮的标签
<description>--该文本输入区的描述
<name>--文本输入区的名称
<link>--处理文本输入的CGI脚本的URL
使用<textInput>的目的有些神秘(?)。你可以用它提供一个搜索引擎输入框,或让读者提供反馈信息。许多聚合器忽略该节点。

<item>的节点
一个频道可以包含许多项目(item)节点。一个项目可以代表一个故事——比如说一份报纸或杂志上的故事,如果是这样的话,那么项目的描述则是故事的概要,项目的链接则指向整个故事的存放位置。项目的所有节点都是可选的,但是至少要包含至少一个标题(title)和描述(description)。

节点 描述 范例
title item的标题 Venice Film Festival Tries to Quit Sinking
link item的URL  http://www.nytimes.com/2002/09/07/movies/07FEST.html
description item概要 Some of the most heated chatter at the Venice Film Festival this week was about the way that the arrival of the stars at the Palazzo del Cinema was being staged.
author 作者的email地址 oprah@oxygen.net
category item可以包含在一个或多个分类中 Simpsons Characters
comments 与item相关的评论的地址 http://www.myblog.org/cgi-local/mt/mt-comments.cgi?entry_id=290
enclosure 附加的媒体对象
guid 可以唯一确定item的字符串 http://inessential.com/2002/09/01.php#a2
pubDate item发布的时间 Sun, 19 May 2002 15:21:36 GMT
source rss频道来源 Quotes of the Day
原文地址:https://www.cnblogs.com/MaYong/p/1402429.html