作者TonyQ (骨頭)
看板Web_Design
標題Re: [問題] database與xml
時間Tue Jun 24 23:59:10 2008
※ 引述《Arton0306 (Ar藤)》之銘言:
: 我搞不太清楚有資料庫
: 為什麼還要用xml去產生html
: 一般動態網頁都將資料存在database
: 接著再讀取 動態形成一html檔傳到client端
: 那xml的作用是??
為了取得資料的時候,也同時取得規格,
簡單來說,他也是一種資料的呈現方式,而不是用來取代資料庫的。
ht
ml
x
ml
html看成xml會不會讓你比較能理解這概念?
(事實上真的是,不過不嚴謹而已,
我們習慣說嚴謹遵循xml格式的html為xhtml。)
所謂的meta language 都有這樣的成份。
比方說像rss就是個經典的例子,以我的ppolis rss來說。
<channel>
<title>Tony1223(Rover) 的最新PPolis好友動態</title>
<link>
http://ppolis.tw</link>
<description>PPolis 好友最新動態</description>
<language>zh-tw</language>
<ttl>60</ttl>
<image>
<url>
http://ppolis.tw/images/logo.gif</url>
<link>
http://ppolis.tw</link>
<title>ppolis</title>
</image>
<item>
<title>nchild 更新個人描述</title>
<link>
http://ppolis.tw/user/nchild</link>
</item>
</channel>
裡面就有定義channel, 標題,對應到的網頁超連結,
以及我的rss icon圖片,跟rss的內容(item)。
所有rss reader只要遵照這個模式去做parse就好了,
這也是網路上逐漸流行的模式。
或者像 youtube api的模式,
http://0rz.tw/a94i2 (說明文件),
他的評論取得就是用 xml 的方式定義。
http://gdata.youtube.com/feeds/api/videos/VIDEO_ID/comments
for example
http://gdata.youtube.com/feeds/api/videos/WX3R-cHMOQg/comments
總之,meta language 都具有表示結構與表示語意的兩種特性。
--
What do you want to have ? / What do you have?
從書本中,你可以發現我的各種興趣。
從CD中,你可以瞭解我所喜歡的偶像明星。
或許從文字你很難以瞭解一個人,但從物品可以。
My PPolis , My past. http://ppolis.tw/user/Tony
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.134.27.68
→ gpmm:嚇,T大有在用 ppolis 喔 :Q 06/25 01:15
→ TonyQ:...............我.......樓上這問題我們私下討論........XD 06/25 01:19
→ TonyQ:這還是我第一次被問這個問題 XDDD 06/25 01:44