asp如何读取XML?

来源:百度知道 编辑:UC知道 时间:2024/05/16 17:40:01
asp如何读取XML?
我想要一个xml的文件,一个asp的文件,让asp文件能读取xml文件的内容!

ASP文件:

<%Response.Charset="gb2312"%>
<html>
<title>read xml</title>
<body>
<%
dim node,i,nodecount
set xml = CreateObject("Microsoft.XMLDOM")
xml.async = false
xml.load(Server.MapPath("data.xml"))
set root = xml.documentElement
set nodeLis = root.childNodes
nodeCount = nodeLis.length
For i=1 to nodeCount
set node = nodeLis.nextNode()
set cost = node.attributes.getNamedItem("cost")
%>
第 <%=i%> 条记录:
<table width="250" border="1">
<tr>
<td>书名</td>
<td>出版社</td>
<td>价格</td>
</tr>
<tr>
<td>
<%=node.selectSingleNode("name").text%></td>
<td>
<%=node.selectSingleNode("publisher").text%></td>
<td>
<%= node.se