Dom|xml
Open the XML file with the Xmldom method, if the local is not a problem, is the use of Server.MapPath ("Xml.xml") method, then the normal analysis of the content, but the direct use of the URL does not show the XML content (in the XMLDOM representation is the support URL way) , and then studied the discovery that the XMLHTTP method can be used to obtain XML and then analyze the code as follows:
Set http=server.createobject ("Microsoft.XMLHTTP")
http. Open "Get", "Http://localhost/xml.xml", False
Http.send
Set xml=server.createobject ("Microsoft.XMLDOM")
Xml. Async=false
Xml. Validateonparse=false
Xml. Load (http. Responsexml)
If XML. Readystate>2 Then
Response.Write (the document is ready to go.) Status: "& XML. ReadyState & "<br>")
Set item=xml.getelementsbytagname ("item")
For I=0 to (item. LENGTH-1)
Set Title=item. Item (i). getElementsByTagName ("title")
Set Link=item. Item (i). getElementsByTagName ("link")
Response.Write ("<a href=" "" "& Link. Item (0). Text & "" > "& title. Item (0). Text & "</a><br>")
Next
Else
Response.Write ("The document is not ready yet.) Status: "& XML. ReadyState & "<br>")
End If
Set http=nothing
Set xml=nothing
The contents of the Xml.xml document are as follows:
<?xml version= "1.0" encoding= "Utf-8"?>
<channel>
<item>
<title> Test Documentation 1</title>
<link>http://localhost/</link>
</item>
<item>
<title> Test Documentation 2</title>
<link>http://localhostindex.asp</link>
</item>
</channel>