asp读取xml实例代码

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

asp读取xml实例代码language.xml
复制代码代码如下:
<?xml version="1.0" encoding="gb2312"?>
<languageRoot>
<!--简体中⽂-->
<language>
<LanguageName>简体中⽂</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
复制代码代码如下:
<%
Set objXML2 = Server.CreateObject("Msxml2.DOMDocument")
objXML2.async = False
loadResult = objXML2.load(Server.MapPath("language.xml"))
if not loadResult then
Response.write "装载XML⽂件错误"
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
%>
以上代码,经编辑测试通过。

相关文档
最新文档