利用ASP从远程服务器上接收XML数据的方法
2018-09-06 12:32
复制代码 代码如下:<%
dimobjXML
dimobjRootElement
dimstrValue
dimstrInetURL
dimstrXML
dimitem
strInetURL=
DimHttpReq
setHttpReq=server.CreateObject(MSXML2.XMLHTTP)
HttpReq.openGET,
HttpReq.send
strXML=HttpReq.responseText
SetobjXML=Server.CreateObject(Msxml2.DOMDocument)
objXML.validateonparse=true
objXML.async=false
objXML.loadXML(strXML)
ifobjXML.ParseError.errorCode<>0then
Response.Write(Error:&objXML.parseError.reason&<br>)
Response.Write(Code:0x&hex(objXML.parseError.errorCode)&<br>)
Response.Write(AtLine:&objXML.parseError.line&<br>)
Response.Write(Atpos:&objXML.parseError.linePos&<br>)
else
setobjRootElement=objXML.documentElement
ifnotisObject(objRootElement)then
Response.Write(nofileloaded)
else
Response.Write(objRootElement.childnodes(0).text)
endif
endif
%>
文章标题:利用ASP从远程服务器上接收XML数据的方法
文章链接:http://soscw.com/index.php/essay/10416.html