RSS 實例
這些範例使用我們的RSS閱讀器來示範RSS。
RSS <channel> 元素
設定channel 元素的必選項(<title>, <link>, and <description>)
<?xml version="1.0" encoding="ISO-8859-1" ?> <!-- Edited by XMLSpy® --> <rss version="2.0"> <channel> <title>W3Cschool Home Page</title> <link>http://www.w3cschool.cc</link> <description>Free web building tutorials</description> </channel> </rss>
<?xml version="1.0" encoding="ISO-8859-1" ?> <!-- Edited by XMLSpy® --> <rss version="2.0"> <channel> <title>W3Cschool Home Page</title> <link>http://www.w3cschool.cc</link> <description>Free web building tutorials</description> <category>IT/Internet/Web development</category> <item> <title>RSS Tutorial</title> <link>http://www.w3cschool.cc/rss</link> <description>New RSS tutorial on W3Cschool</description> <category>News</category> <category>Tutorial</category> </item> </channel> </rss>
<?xml version="1.0" encoding="ISO-8859-1" ?> <!-- Edited by XMLSpy® --> <rss version="2.0"> <channel> <title>W3Cschool Home Page</title> <link>http://www.w3cschool.cc</link> <description>Free web building tutorials</description> <generator>Notepad</generator> <item> <title>RSS Tutorial</title> <link>http://www.w3cschool.cc/rss</link> <description>New RSS tutorial on W3Cschool</description> </item> </channel> </rss>
<?xml version="1.0" encoding="ISO-8859-1" ?> <!-- Edited by XMLSpy® --> <rss version="2.0"> <channel> <title>W3Cschool Home Page</title> <link>http://www.w3cschool.cc</link> <description>Free web building tutorials</description> <image> <url>http://www.w3cschool.cc/images/logo.png</url> <title>W3Cschool.cc</title> <link>http://www.w3cschool.cc</link> </image> <item> <title>RSS Tutorial</title> <link>http://www.w3cschool.cc/rss</link> <description>New RSS tutorial on W3Cschool</description> </item> </channel> </rss>
執行實例»
實例#
##點擊"運行實例"按鈕查看線上實例
為RSS 指定語言實例#
<?xml version="1.0" encoding="ISO-8859-1" ?> <!-- Edited by XMLSpy® --> <rss version="2.0"> <channel> <title>W3Cschool Home Page</title> <link>http://www.w3cschool.cc</link> <description>Free web building tutorials</description> <language>en-us</language> <item> <title>RSS Tutorial</title> <link>http://www.w3cschool.cc/rss</link> <description>New RSS tutorial on W3Cschool</description> </item> </channel> </rss>
##執行實例»##點擊"運行實例" 按鈕查看線上實例
為RSS 新增文字輸入框
#實例<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- Edited by XMLSpy® -->
<rss version="2.0">
<channel>
<title>W3Cschool Home Page</title>
<link>http://www.w3cschool.cc</link>
<description>Free web building tutorials</description>
<textinput>
<description>Search Google</description>
<title>Search</title>
<link>http://www.google.no/search?</link>
<name>q</name>
</textinput>
<item>
<title>RSS Tutorial</title>
<link>http://www.w3cschool.cc/rss</link>
<description>New RSS tutorial on W3Cschool</description>
</item>
</channel>
</rss>
運行實例»
點擊"運行實例" 按鈕查看線上實例
######為RSS 指定不需要更新的天########實例##### #<?xml version="1.0" encoding="ISO-8859-1" ?> <!-- Edited by XMLSpy® --> <rss version="2.0"> <channel> <title>W3Cschool Home Page</title> <link>http://www.w3cschool.cc</link> <description>Free web building tutorials</description> <skipDays> <day>Saturday</day> <day>Sunday</day> </skipDays> <item> <title>RSS Tutorial</title> <link>http://www.w3cschool.cc/rss</link> <description>New RSS tutorial on W3Cschool</description> </item> </channel> </rss>#########運行實例»#####點擊"運行實例"按鈕查看線上實例############實例解析####### ##RSS <item> 元素######設定必選項(<title>, <link>, and <description>)##########實例#######
<?xml version="1.0" encoding="ISO-8859-1" ?> <!-- Edited by XMLSpy® --> <rss version="2.0"> <channel> <title>W3Cschool Home Page</title> <link>http://www.w3cschool.cc</link> <description>Free web building tutorials</description> <item> <title>RSS Tutorial</title> <link>http://www.w3cschool.cc/rss</link> <description>New RSS tutorial on W3Cschool</description> </item> <item> <title>XML Tutorial</title> <link>http://www.w3cschool.cc/xml</link> <description>New XML tutorial on W3Cschool</description> </item> </channel> </rss>#########運行實例»######點擊"運行實例"按鈕查看線上實例#########給RSS 項目新增註解連結####### ##實例######
<?xml version="1.0" encoding="ISO-8859-1" ?> <!-- Edited by XMLSpy® --> <rss version="2.0"> <channel> <title>W3Cschool Home Page</title> <link>http://www.w3cschool.cc</link> <description>Free web building tutorials</description> <item> <title>RSS Tutorial</title> <link>http://www.w3cschool.cc/rss</link> <description>New RSS tutorial on W3Cschool</description> <comments>http://www.w3cschool.cc/rss/comments.php</comments> </item> </channel> </rss>####
運行實例»
點擊"運行實例" 按鈕查看線上實例
#為RSS 專案新增媒體檔案
實例
<?xml version="1.0" encoding="ISO-8859-1" ?> <!-- Edited by XMLSpy® --> <rss version="2.0"> <channel> <title>W3Cschool Home Page</title> <link>http://www.w3cschool.cc</link> <description>Free web building tutorials</description> <item> <title>RSS Tutorial</title> <link>http://www.w3cschool.cc/rss</link> <description>New RSS tutorial on W3Cschool</description> <enclosure url="http://www.w3cschool.cc/media/3d.wmv" length="78645" type="video/wmv" /> </item> </channel> </rss>
執行實例»
點擊"運行實例" 按鈕查看線上實例
為專案新增唯一識別碼
實例
<?xml version="1.0" encoding="ISO-8859-1" ?> <!-- Edited by XMLSpy® --> <rss version="2.0"> <channel> <title>W3Cschool Home Page</title> <link>http://www.w3cschool.cc</link> <description>Free web building tutorials</description> <item> <title>RSS Tutorial</title> <link>http://www.w3cschool.cc/rss</link> <description>New RSS tutorial on W3Cschool</description> <guid>http://www.w3cschool.cc/rss/item0768</guid> </item> </channel> </rss>
運行實例»
點擊"運行實例" 按鈕查看線上實例
為RSS 專案新增發布資料
實例
<?xml version="1.0" encoding="ISO-8859-1" ?> <!-- Edited by XMLSpy® --> <rss version="2.0"> <channel> <title>W3Cschool Home Page</title> <link>http://www.w3cschool.cc</link> <description>Free web building tutorials</description> <item> <title>RSS Tutorial</title> <link>http://www.w3cschool.cc/rss</link> <description>New RSS tutorial on W3Cschool</description> <pubDate>Thu, 27 Apr 2006</pubDate> </item> </channel> </rss>
#執行實例»##點擊"運行實例"按鈕查看在線實例
實例#
點擊"運行實例" 按鈕查看線上實例
實例解析<?xml version="1.0" encoding="ISO-8859-1" ?> <!-- Edited by XMLSpy® --> <rss version="2.0"> <channel> <title>W3Cschool Home Page</title> <link>http://www.w3cschool.cc</link> <description>Free web building tutorials</description> <item> <title>RSS Tutorial</title> <link>http://www.w3cschool.cc/rss</link> <description>New RSS tutorial on W3Cschool</description> <source url="http://www.w3cschool.cc">W3Cschool.cc</source> </item> </channel> </rss>##執行實例»
點擊"運行實例" 按鈕查看線上實例
#