Professional Documents
Culture Documents
資三甲 古宗玄
資三丙 許嘉仁
資三甲 吳昌鴻
研究動機
我們則選擇製作與生活較相關新聞閱讀器,也就是將有提
供 RSS 訂閱功能的新聞網站,利用 Widget 製作成 RSS 閱讀
器。
何謂 Widget ??
<rss version="2.0">
<channel>
<title>Yahoo! 奇摩新聞 - 即時新聞 </title>
<link>http://tw.news.yahoo.com/realtime/0.html</link>
<description>Yahoo! 奇摩新聞 - 即時新聞 </description>
<language>zh-tw</language>
<lastBuildDate>Sun, 5 Feb 2006 02:15:07 GMT</lastBuildDate>
<ttl>5</ttl>
<item>
<title> 強風迫使美國華盛頓州 16 萬戶斷電 </title>
<link>http://tw.news.yahoo.com/060205/4/2to0n.html</link>
<pubDate>Sun, 5 Feb 2006 02:00:00 GMT</pubDate>
</item>
</channel>
</rss>
showRSS
var nodes = rssDOM.evaluate("rss/channel/item");
從讀入的 rssDOM 這個 DOMDocument 物件中,萃取 rss ->
channel 下的所有 item 項目,然後存在 nodes 這個變數中。
newItem = new Array();
新製作的一個物件,每一則新聞都會對應到一個這樣的物件
newItem.title /newItem.link =
(nodes.item(i).getElementsByTagName("title/link")).item(0).fir
stChild.data;
從 RSS Feed 分析而來的新聞標題和新聞網頁連結。
newItem.pubDate = new
Date(Date.parse((nodes.item(i).getElementsByTagName("pu
bDate")).item(0).firstChild.data));
從 RSS Feed 分析而來的新聞發布時間。
心得
透過這次專題的實作,對 Widget 有更深入的了解,這次實
作我們發現由 Yahoo 官方所提供的 widget 作品都無法利用
Widget Converter 來拆卸並得知其內容,所以想要惡搞
都沒辦法 !
JavaScript 大全第四版
http://widgets.yahoo.com/
http://www.libertytimes.com.tw/rss/index.htm