- 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.tw</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.tw/images/to-logo.gif</url>
必需
必需,如果 <image> 標籤可用。
最大長度
1-500 個字元。
Image 連結 (URL)
如果您使用 image 標籤,則也必須使用此標籤。
語法
<link>https://tutorialspoint.tw/</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.tw/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.tw/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.tw</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.tw/images/to-logo.gif</url>
<link>https://tutorialspoint.tw</link>
<width>88</width>
<height>31</height>
<description>
Tutorials, Articles, discussions,and more...
</description>
</image>
<item>
<title>RSS Tutorials</title>
<link>https://tutorialspoint.tw/rss/index.htm</link>
<description>
Learn RSS in simple and easy steps.
</description>
</item>
<item>
<title>PHP Tutorials</title>
<link>https://tutorialspoint.tw/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.tw/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。