- RSS 教程
- RSS - 首页
- RSS - 什么是 RSS?
- RSS - 优势
- RSS - 版本历史
- RSS - Feed 格式
- RSS - 阅读 Feed
- RSS - Feed 发布
- RSS - Feed 验证
- RSS - 什么是 Atom?
- RSS - 扩展阅读
- RSS - 总结
- RSS 有用参考
- RSS - 快速指南
- RSS - 有用资源
- RSS - 讨论
RSS - 0.91 版本标签和语法
这是一个 RSS 0.91 文档的结构
<?xml version="1.0"?>
<!DOCTYPE rss
PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
"http://my.netscape.com/publish/formats/rss-0.91.dtd">
<rss version="0.91">
<channel>
<title>...</title>
<link>...</link>
<description>...</description>
<language>...</language>
<rating>...</rating>
<copyright>...</copyright>
<pubDate>...</pubDate>
<lastBuildDate>...</lastBuildDate>
<docs>...</docs>
<managingEditor>...</managingEditor>
<webMaster>...</webMaster>
<skipHours>
<hour>...</hour>
</skipHours>
<skipDays>
<day>...</day>
</skipDays>
<image>
<title>...</title>
<url>...</url>
<link>...</link>
<width>...</width>
<height>...</height>
<description>...</description>
</image>
<item>
<title>...</title>
<link>...</link>
<description>...</description>
</item>
<!-- More item tags -->
<textInput>
<title>...</title>
<description>...</description>
<name>...</name>
<link>...</link>
</textInput>
</channel>
</rss>
以下是所有与 RSS 0.91 相关的可选和必填标签的详细信息。查看给出的示例,为您的网站准备一个 RSS v0.91 Feed。
注意:所有标签都区分大小写,应谨慎使用。
以下是所有与 RSS 0.91 相关的可选和必填标签的列表。
XML 版本标识符
作为 XML 应用程序,RSS 文档不需要以 XML 声明开头。它应该以 XML 版本标识符标签开头。
语法
- <?xml version="1.0"?> 或
- <?xml version="1.0" encoding="[此处编码代码]"?>
这是一个 RSS v0.91 支持的编码列表。
必需
始终且准确。可选的编码属性(默认为 UTF-8)。
文档类型标识符
类似于有效的 XHTML 文档,需要指定文档类型。
语法
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">
必需
始终且准确。
最大长度
500 个字符。
RSS 版本标识符
语法
<rss version="0.91">
必需
始终且准确。
最大长度
500 个字符。
开始 Channel 标签
每个 RSS0.91 文件中应有一个 channel 开始标签。
语法
<channel>
必需
必需。每个 RSS 文件最多 1 个。
Channel 标题
资源的标识字符串。在项目中使用时,这是项目链接的名称。在图像中使用时,这是图像的替代文本。在 channel 中使用时,这是 channel 的标题。在 textinput 中使用时,这是 textinput 的标题。
语法
<title>TutorialsPoint</title>
必需
必需。
最大长度
1-100 个字符。
Channel 描述
channel 将具有如下所述的 description 标签
语法
<description>Your source for tutorials, references and manuals!</description>
必需
必需。
最大长度
1-500 个字符。
Channel 标题链接 (URL)
这是您主页的链接,并且 channel 必须包含此链接。
语法
<link>https://tutorialspoint.com</link>
必需
必需。
最大长度
1-500 个字符。
Channel 语言
它指定 channel(网站)的语言。
语法
<language>[ language code here ]</language>
这是一个 RSS v0.91 支持的语言列表。
必需
必需。
最大长度
2-25 个字符。
Channel 等级
有关如何使用 Channel 等级的完整详细信息,让我们现在查看 如何使用 PICS 等级。
语法
<rating>[ PICS rating here ]</rating>
必需
可选。每个 channel 最多 1 个。
最大长度
20-500 个字符。
版权标识符
此标签允许在 RSS 0.91 文件中使用,但 Netcenter 实际上并不使用此标签或其数据。RSS 0.91 格式支持此标签,以利于可能使用此标签及其数据的其他站点。
语法
<copyright>Copyright 2007, TutorialsPoint</copyright>
必需
可选,Netcenter 忽略。每个 channel 最多 1 个。
最大长度
1-100 个字符。
发布时间
此标签允许在 RSS 0.91 文件中使用,但 Netcenter 实际上并不使用此标签或其数据。RSS 0.91 格式支持此标签,以利于可能使用此标签及其数据的其他站点。
语法
<pubDate>Thu, 19 Jul 2007 07:00:00 GMT</pubDate>
必需
可选,Netcenter 忽略。每个 channel 最多 1 个。
最大长度
1-100 个字符。
上次构建日期
此标签允许在 RSS 0.91 文件中使用,但 Netcenter 实际上并不使用此标签或其数据。RSS 0.91 格式支持此标签,以利于可能使用此标签及其数据的其他站点。
语法
<lastBuildDate>Thu, 19 Jul 2007 16:20:26 GMT </lastBuildDate>.
必需
可选,Netcenter 忽略。每个 channel 最多 1 个。
最大长度
1-100 个字符。
外部 Channel 描述文件 (URL)
此标签允许在 RSS 0.91 文件中使用,但 Netcenter 实际上并不使用此标签或其数据。RSS 0.91 格式支持此标签,以利于可能使用此标签及其数据的其他站点。
语法
<docs>http://my.userland.com/stories/storyReader$11</docs>
必需
可选,Netcenter 忽略。每个 channel 最多 1 个。
最大长度
1-500 个字符。
管理编辑
此标签允许在 RSS 0.91 文件中使用,但 Netcenter 实际上并不使用此标签或其数据。RSS 0.91 格式支持此标签,以利于可能使用此标签及其数据的其他站点。
语法
<managingEditor>mohtashim@tutorialspoint.com</managingEditor>
必需
可选,Netcenter 忽略。每个 channel 最多 1 个。
最大长度
1-100 个字符。
网站管理员
此标签允许在 RSS 0.91 文件中使用,但 Netcenter 实际上并不使用此标签或其数据。RSS 0.91 格式支持此标签,以利于可能使用此标签及其数据的其他站点。
语法
<webMaster>mohtashim@tutorialspoint.com</webMaster>
必需
可选,Netcenter 忽略。每个 channel 最多 1 个。
最大长度
1-100 个字符。
开始 Skip Hours 标签
一个 <hours> 列表,指示一天中 channel 不太可能更新的小时数(格林尼治标准时间)。如果省略此子项,则假定 channel 每小时更新一次。
语法
<skipHours>
必需
可选,Netcenter 忽略。每个 channel 最多 1 个。
小时
如果您使用 skipHours 标签,则也必须使用此标签。
语法
<hour>7</hour>
必需
必需,如果 <skipHours>。每个 <skipHours> 元素最多 24 个。
最大长度
数值:0 - 23
结束 Skip Hours
如果您使用 skipHours 标签,则也必须使用此标签。
语法
</skipHours>
必需
必需,如果 <skipHours>。
开始 Skip Days 标签
一个 <days> 列表,以英文表示一周中的几天,指示您的 channel 不更新的星期几。
语法
<skipDays>
必需
可选,Netcenter 忽略。每个 channel 最多 1 个。
星期
如果您使用 skipDays 标签,则也必须使用此标签。
语法
<day>Monday</day>
必需
必需,如果 <skipDays>。每个 <skipDays> 元素最多 7 个。
最大长度
1-10 个字符
结束 Skip Days
如果您使用 skipDays 标签,则也必须使用此标签。
语法
</skipDays>.
必需
必需,如果 <skipDays>。
开始 Image 标签
您可以在 channel 内包含一个 image 开始标签。
语法
<image>
必需
可选。每个 channel 最多 1 个。
Image 替代文本
如果您使用 image 标签,则也必须使用此标签。
语法
<title>TutorialsPoint Logo</title>
必需
必需,如果 <image> 标签可用。
最大长度
1-500 个字符。
Image 位置 (URL)
从中加载资源的位置。请注意,这与 link 标签略有不同,link 标签指定如果选择资源,用户应重定向到的位置。
语法
<url>https://tutorialspoint.com/images/to-logo.gif</url>
必需
必需,如果 <image> 标签可用。
最大长度
1-500 个字符。
Image 链接 (URL)
如果您使用 image 标签,则也必须使用此标签。
语法
<link>https://tutorialspoint.com/</link>
必需
可选,如果 <image> 标签可用。
最大长度
1-500 个字符。
Image 宽度
如果您使用 image 标签,则可以使用此标签(可选)。
语法
<width>[ numeric value here ]</width>
必需
可选,如果 <image> 标签可用。
最大长度
数值:1-144(默认为 88)。
Image 高度
这是一个可选标签。
语法
<height>[ numeric value here ]</height>
必需
可选,如果 <image> 标签可用。
最大长度
数值:1-400(默认为 31)。
Image 描述
如果您使用 image 标签,则可以使用此标签(可选)。
语法
<description>Articles, discussions, builds, and more...</description>
必需
可选,如果 <image> 标签可用。
最大长度
1-100 个字符。
结束 Image 标签
如果您使用 image 标签,则也必须使用此标签。
语法
</image>
必需
必需,如果 <image> 标签可用。
开始 Item 标签
这是一个可选标签,您可以在 channel 标签内包含 0-15 个 item 标签。
语法
<item>
必需
可选。每个 channel 允许 0-15 个项目。
Item 标题
如果您使用 title 标签,则也必须使用此标签。
语法
<title>Learning RSS</title>
必需
必需,如果 <title> 标签可用。
最大长度
1-100 个字符。
Item 链接 (URL)
如果您使用 title 标签,则也必须使用此标签。
语法
<link>https://tutorialspoint.com/rss/index.htm</link>
必需
必需,如果 <title> 标签可用。
最大长度
1-500 个字符。
Item 描述
如果您使用 title 标签,则可以使用此标签(可选)。
语法
<description>RSS Tutorials Online. Read more about it in this discussion...</description>
必需
可选,如果 <title> 标签可用。
最大长度
1-500 个字符。
结束 Item 标签
如果您使用 title 标签,则也必须使用此标签。
语法
</item>
开始 Text Input 标签
一个输入字段,用于允许用户向发布者的站点提交查询。此元素应具有标题、链接(到 cgi 或其他处理器)、包含一些说明的描述和名称,用作 HTML 标签 <input type=text name="[name]"> 中的名称。
语法
<textInput>
必需
可选。每个 channel 最多 1 个。
TextInput 标题(提交按钮的标签)
如果您使用 textInput 标签,则也必须使用此标签。
语法
<title>Send</title>
必需
必需,如果 <textInput> 标签可用。
最大长度
1-100 个字符。
TextInput 描述
如果您使用 textInput 标签,则也必须使用此标签。
语法
<description>Comments about TutorialsPoint?</description>
必需
必需,如果 <textInput> 标签可用。
最大长度
1-500 个字符。
TextInput 名称
如果您使用 textInput 标签,则也必须使用此标签。
语法
<name>[ value of name= attribute of input tag here ]</name>
必需
必需,如果 <textInput> 标签可用。
最大长度
1-20 个字符。
TextInput 链接
这是将处理传递数据的脚本的链接。如果您使用 textInput 标签,则也必须使用此标签。
语法
<link>https://tutorialspoint.com/cgi-bin/sampleonly.cgi</link>
必需
必需,如果 <textInput> 标签可用。
最大长度
1-500 个字符。
结束 Text Input 标签
如果您使用 textInput 标签,则也必须使用此标签。
语法
<textInput>
必需
必需,如果 <textInput> 标签可用。
结束 Channel 标签
channel 开始标签需要一个结束 channel 标签。
语法
</channel>
必需
必需。
结束 RSS 标签
这是 RSS0.91 文档的结束标签。
语法
</rss>
必需
必需。
使用特殊字符和 HTML 实体
尽管 RSS 0.91 文件是 XML 文档,但 RSS 0.91 通过支持全套 HTML 实体来扩展 XML。如果您想在 <url> 或 <link> 标签中使用特殊字符(如&符号(&)),则必须将相应的十进制或 HTML 实体替换为这些字符。
查看我们在 HTML 教程中提供的 HTML 实体 的完整集合。
RSS v0.91 示例 Feed
这是一个示例,演示了如何使用 0.91 版本编写 RSS Feed。
<?xml version="1.0"?>
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
"http://my.netscape.com/publish/formats/rss-0.91.dtd">
<rss version="0.91">
<channel>
<title>TutroialsPoint</title>
<link>https://tutorialspoint.com</link>
<description>
Online Tutorials and Reference Manuals.
</description>
<language>en-us</language>
<rating>
(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l
gen true comment "RSACi North America Server" for
"http://www.rsac.org" on "1996.04.16T08:15-0500"
r (n 0 s 0 v 0 l 0))
</rating>
<image>
<title>TutroialsPoint</title>
<url>https://tutorialspoint.com/images/to-logo.gif</url>
<link>https://tutorialspoint.com</link>
<width>88</width>
<height>31</height>
<description>
Tutorials, Articles, discussions,and more...
</description>
</image>
<item>
<title>RSS Tutorials</title>
<link>https://tutorialspoint.com/rss/index.htm</link>
<description>
Learn RSS in simple and easy steps.
</description>
</item>
<item>
<title>PHP Tutorials</title>
<link>https://tutorialspoint.com/php/index.htm</link>
<description>
Learn PHP in simple and easy steps.
</description>
</item>
<textInput>
<title>Send</title>
<description>Comments about TutoprialsPoint</description>
<name>responseText</name>
<link>
https://tutorialspoint.com/cgi-bin/tp-contact.cgi
</link>
</textInput>
</channel>
</rss>
RSS 0.91 文件扩展名
RSS 0.91 文档不需要特定的文件扩展名。建议使用 .rdf 或 .xml,前者更佳。
RSS 0.91 DTD
查看以下链接 RSS 0.91 DTD。