如何用asp加載直接顯示xml呢
當(dāng)前位置:點(diǎn)晴教程→知識(shí)管理交流
→『 技術(shù)文檔交流 』
比如我有個(gè)xml文件,需要在前臺(tái)顯示其中的一部分,所以用asp加載。 但加載現(xiàn)實(shí)就是單純的文字了,怎么在把他現(xiàn)實(shí)成xml文檔啊。 代碼如下:book.xml <?xml version="1.0" encoding="gb2312" ?> <booklist> <book isbn="1231"> <title>0AJAX高級(jí)程序設(shè)計(jì)</title> <author>AJAX是一本不錯(cuò)的書,大家都可以去看看</author> <publisher>wrox</publisher> </book> </booklist> xuanze.asp頁(yè)面: <%option explicit%> <% dim objxml,i set objxml=server.createobject("microsoft.xmldom") objxml.async=false objxml.load(server.mappath("book.xml")) Response.ContentType="text/xml" Response.CharSet = "gb2312" Response.Write("<?xml version=""1.0"" encoding=""gb2312""?>") response.write "<booklist>" response.write"<book>" response.write "<title>"&objxml.childnodes(1).childnodes(0).childnodes(0).text&"</title>" response.write "<author>"&objxml.childnodes(1).childnodes(0).childnodes(1).text&"</author>" response.write "<publisher>"&objxml.childnodes(1).childnodes(0).childnodes(2).text&"</publisher>" response.write "</book>" response.write "</booklist>" %> 有沒(méi)有好的方法啊,直接加載xml,直接現(xiàn)實(shí),而不要在在寫一編代碼啊。 該文章在 2011/4/13 15:14:37 編輯過(guò)
|
關(guān)鍵字查詢
相關(guān)文章
正在查詢... |