Author: Unknown opened with xmldom method xml file, if it is not a local problem, is to use Server.MapPath ( "xml.xml") method, then the normal analysis of the content, but does not directly show the url xml content (The XMLDOM is said to support URL mode), then study finds that it can be found after XML with XMLHTTP, and the code is as follows:
SET http = server.createObject ("Microsoft.xmlhttp") http.open "get", "http://localhost/xml.xml", falsehttp.send
SET XML = Server.createObject ("Microsoft.xmLDom") XML.Assync = falsexml.validateonParse = falsexml.load (http.responsexml) if Xml.ReadyState> 2 Then Response.write ("Document is ready. Status:" & XML.ReadyState & "
") set item = Xml.GtelementsBytagname ("item") for i = 0 to (item.length-1) set title = item.Item (i) .getelementsBytagname ("Title") SET Link = Item.Item (i) .getelementsBytagname ("LINK") response.write ("" & title.Item (0). Text & "
") NEXTELSE RESPONSE.WRITE ("document is not ready. Status:" & XML.ReadyState & "
") end ifset http = NothingSet XML = Nothing
The content of the XML.xml document is as follows:
XML Version = "1.0" encoding = "UTF-8"?>