用asp.net和xml做的新聞更新系統(1)
來源:互聯網
上載者:User
asp.net|xml 讀了很多關於.net的文章,也看了許多關於xml的資料,我已經深深的被他們的魅力所吸引。在網上的論壇中,大家對於.net的討論更加火熱一些,而我們的同事從微軟回來後告訴我,其實xml是一個比.net更好的東西。包括其中的xslt,其未來要遠遠比.net要好。
其實爭論誰好誰壞本身是沒有多大意思的,因為.net本身已經和xml緊密的結合在一起了。這裡我就用xml代替資料,寫一個新聞發布系統,希望能夠起到拋磚引玉的作用,使更多的人能夠瞭解這些最新的技術。
下面介紹這幾個檔案。 </P><P>contents.xml
<?xml version="1.0" encoding="GB2312"?>
<topiclist type="AspCool News">
<topic>
<title>aspcool news!</title>
<href>main.aspx?name=hello</href>
</topic>
<topic>
<title>Resolve a problem</title>
<href>main.aspx?name=test</href>
</topic>
</topiclist> </P><P>這是一個很簡單的xml檔案,它的作用是用來顯示新聞的列表。 </P><P>hello.xml </P><P><?xml version="1.0" encoding="GB2312"?>
<document>
<title>aspcool news!</title>
<abstract>test news</abstract>
<author>feiying</author>
<content>
<paragraph>The firet test</paragraph>
</content>
</document> </P><P>這個檔案是用來顯示新聞的內容,其中各個意思大家一看就明白,我就不在這兒多說了。如果你對xml還不太熟悉,可以先到本站(www.aspcool.com)的xml專欄看一看。