asp讀取xml實(shí)例代碼
當(dāng)前位置:點(diǎn)晴教程→知識(shí)管理交流
→『 技術(shù)文檔交流 』
讀取xml文件的實(shí)例代碼。 language.xml 復(fù)制代碼 代碼如下: <?xml version="1.0" encoding="gb2312"?> <languageRoot> <!--簡(jiǎn)體中文--> <language> <LanguageName>簡(jiǎn)體中文</LanguageName> <LanguageValue>SimpilifiedChinese</LanguageValue> <LanguageImages>images</LanguageImages> <LanguageFile></LanguageFile> </language> <!--繁體中文--> <language1> <LanguageName>繁體中文</LanguageName> <LanguageValue>TraditionalChinese</LanguageValue> <LanguageImages>imagesBig5</LanguageImages> <LanguageFile>ddd</LanguageFile> </language1> </languageRoot> sl.asp 復(fù)制代碼 代碼如下: <% Set objXML2 = Server.CreateObject("Msxml2.DOMDocument") objXML2.async = False loadResult = objXML2.load(Server.MapPath("language.xml")) if not loadResult then
Response.write "裝載XML文件錯(cuò)誤" Response.end end If Set objNodes = objXML2.getElementsByTagName("languageRoot/language") For i = 0 to objNodes.length - 1 Response.write Trim(objNodes(i).selectSingleNode("LanguageName").Text)&"<br>" Response.write Trim(objNodes(i).selectSingleNode("LanguageValue").Text)&"<br>" Response.write Trim(objNodes(i).selectSingleNode("LanguageImages").Text)&"<br>" Next set objNodes = Nothing Set objNodes = objXML2.getElementsByTagName("languageRoot/language1") For i = 0 to objNodes.length - 1 Response.write Trim(objNodes(i).selectSingleNode("LanguageName").Text)&"<br>" Response.write Trim(objNodes(i).selectSingleNode("LanguageValue").Text)&"<br>" Response.write Trim(objNodes(i).selectSingleNode("LanguageImages").Text)&"<br>" Response.write Trim(objNodes(i).selectSingleNode("LanguageFile").Text)&"<br>" Next set objNodes = Nothing Set objXML = Nothing %> 該文章在 2010/11/26 9:02:52 編輯過 |
關(guān)鍵字查詢
相關(guān)文章
正在查詢... |