asp读取XML文件
<%
'
Set http=Server.CreateObject("Microsoft.XMLHTTP")
http.Open "GET","http://127.0.0.1/1.xml",False
http.send
Dim xml
Set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False
'xml.load (Server.MapPath("1.xml")) '如果不是远程文件直接这一步
xml.Load(http.ResponseXML)
Dim title, heading, paragraph, ii
title = xml.documentElement.childNodes(0).text
heading = xml.documentElement.childNodes(1).text
paragraph = xml.documentElement.childNodes(1).childNodes(1).childNodes(0).text
ii = xml.documentElement.childNodes(1).childNodes.length
dim i
for i=0 to ii-1
response.Write(i)
response.Write(xml.documentElement.childNodes(1).childNodes(i).childNodes(1).text)
response.Write("<br />")
next
Set xml = Nothing
%>
相关文档:
HTML.html文件
<div align="center" class="style1">
<p>冰棍列表</p>
<p></p>
<table width="400" border="1">
<tr>
<th scope="col"><font size="4">品牌</font></th> ......
xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<mobile-list>
<mobile type="Nokia2652">
<wap2>false</wap2>
<width>115</width>
</mobile>
<mobile type="Nokia2650">
......
xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<mobile-list>
<mobile type="Nokia2652">
<wap2>false</wap2>
<width>115</width>
</mobile>
<mobile type="Nokia2650">
......
xml文件为:
<?xml version="1.0" encoding="UTF-8"?>
<mobile-list>
<mobile type="Nokia2652">
<wap2>false</wap2>
<width>115</width>
</mobile>
<mobile type="Nokia2650">
<wap2>false</wa ......