当前位置: 首页 > 网络学院 > XML相关教程 > RSS > RSS <channel> 元素

RSS
RSS 介绍
RSS 历史
RSS 语法
RSS <channel> 元素
RSS <item> 元素
RSS 发布 Feed
RSS 解读 Feed

RSS <channel> 元素


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 569 ::
收藏到网摘: n/a

The RSS <channel> element describes the RSS feed.
RSS 的 <channel> 元素可描述 RSS feed。


The RSS <channel> Element
RSS <channel> 元素

Look at the following RSS document:
请看下面这个 RSS 文档:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<rss version="2.0">
<channel>
<title>W3Schools Home Page</title>
<link>http://www.w3schools.com</link>
<description>Free web building tutorials</description>

<item>
<title>RSS Tutorial</title>
<link>http://www.w3schools.com/rss</link>
<description>New RSS tutorial on W3Schools</description>

</item>
</channel>
</rss>

As mentioned before, the <channel> element describes the RSS feed, and has three required child elements:
正如前面提到的,<channel> 元素可描述 RSS feed,而拥有三个必需的子元素:

  • <title> - Defines the title of the channel (e.g. ruanchen Home Page)
    <title> - 定义了频道的标题 (比如:W3School主页)
  • <link> - Defines the hyperlink to the channel (e.g. http://www.ruanchen.com)
    <link> - 定义到达频道的超链接 (比如:http://www.ruanchen.com)
  • <description> - Describes the channel (e.g. Free web building tutorials)
    <description> - 描述此频道 (如:免费的建站教程)

The <channel> element usually contains one ore more <item> elements. Each <item> element defines an article or "story" in the RSS feed.
<channel> 通常包含一个或多个 <item> 元素。每个 <item> 元素可定义 RSS feed 中的一篇文章或 "story"。

Furthermore, there are several optional child elements of <channel>. We will explain the most important ones below.
此外,还存在若干个可选的 <channel> 的子元素。我们会在后面讲解最重要的几个。


The <category> Element
<category> 元素

The <category> child element is used to specify a category for your feed.
<category> 子元素用于为 feed 规定种类。

The <category> element makes it possible for RSS aggregators to group sites based on category.
<category> 子元素使 RSS 聚合器基于类别对网站进行分组成为可能。

The category for the RSS document above could be:
上面的 RSS 文档的类别可能会是:

<category>Web development</category>

 


The <copyright> Element
<copyright> 元素

The <copyright> child element notifies about copyrighted material.
<copyright> 子元素会告知有关版本资料的信息。

The copyright for the RSS document above could be:
上面的 RSS 文档的版本可能会是:

<copyright>2006 Refsnes Data as. All rights reserved.</copyright>

 


The <image> Element
<image> 元素

The <image> child element allows an image to be displayed when aggregators present a feed.
<image> 子元素可在聚合器提供某个 feed 时显示一幅图像。

The <image> element has three required child elements:
<image> 有三个必需的子元素:

  • <url> - Defines the URL to the image
    <url> - 定义引用图像的 URL
  • <title> - Defines the text to display if the image could not be shown
    <title> - 定义图像无法被显示时显示的文本
  • <link> - Defines the hyperlink to the website that offers the channel
    <link> - 定义到达提供此频道的网站的超链接

The image for the RSS document above could be:
上面的 RSS 文档的图像可能是这样的:

<image>
<url>http://www.w3schools.com/images/logo.gif</url>
<title>W3Schools.com</title>

<link>http://www.w3schools.com</link>
</image>

 


The <language> Element
<language> 元素

The <language> child element is used to specify the language used to write your document.
<language> 子元素用于规定用来编写文档的语言。

The <language> element makes it possible for RSS aggregators to group sites based on language.
<language> 元素使 RSS 聚合器基于语言来对网站进行分组成为可能。

The language for the RSS document above could be:
上面的 RSS 文档的语言可能是:

<language>us-en</language>

 


RSS <channel> Reference
RSS <channel> 参数

Element
元素
Description
描述
<category> Optional. Defines one or more categories for the feed
任意参数。为 feed 定义所属的一个或多个种类
<cloud> Optional. Register processes to be notified immediately of updates of the feed
任意参数。立即通知注册进程关于 feed 的更新
<copyright> Optional. Notifies about copyrighted material
任意参数。告知版权资料
<description> Required. Describes the channel
任意参数,描述频道
<docs> Optional. Specifies an URL to the documentation of the format used in the feed
任意参数。规定指向当前 RSS 文件所用格式说明的 URL
<generator> Optional. Specifies the program used to generate the feed
任意参数。指定用于生成 feed 的程序
<image> Optional. Allows an image to be displayed when aggregators present a feed
任意参数。在聚合器呈现某个 feed 时允许某个图像被显示
<language> Optional. Specifies the language the feed is written in
任意参数。规定编写 feed 所用的语言
<lastBuildDate> Optional. Defines the last-modified date of the content of the feed
任意参数。定义 feed 的内容最后的修改日期
<link> Required. Defines the hyperlink to the channel
必要参数。定义指向频道的超链接
<managingEditor> Optional. Defines the e-mail address to the editor of the content of the feed
任意参数。定义 feed 的内容编辑的电子邮件地址
<pubDate> Optional. Defines the last publication date for the content of the feed
任意参数。为 feed 的内容定义最后发布日期
<rating> Optional. The PICS rating of the feed
任意参数。feed 的 PICS 级别
<skipDays> Optional. Specifies the days where aggregators should skip updating the feed
任意参数。规定忽略 feed 更新的天数
<skipHours> Optional. Specifies the hours where aggregators should skip updating the feed
任意参数。规定忽略 feed 更新的小时
<textInput> Optional. Specifies a text input field that should be displayed with the feed
任意参数。规定应当与 feed 一同显示的文本输入域
<title> Required. Defines the title of the channel
必要参数。定义频道的标题
<ttl> Optional. Specifies the number of minutes the feed can stay cached before refreshing it from the source
任意参数。指定从 feed 源更新此 feed 之前,feed 可被缓存的分钟数
<webMaster> Optional. Defines the e-mail address to the webmaster of the feed
任意参数。定义此 feed 的 web 管理员的电子邮件地址

评论 (0) All

登陆 | 还没注册?