<%
set xd= server.createobject("msxml2.domdocument.6.0")
xd.async = false
xd.load("http://example.com/test.xml")
set errorlist= xd.selectnodes("/XMLResponse/ServiceList/")
if errorlist.length <> 0 then
response.write "FILE EXIST"
else
Response.Write xd.parseError.reason
end if
%>
当我运行上面的代码时出现错误“指定资源的下载失败”
如何解决?
最佳答案
我遇到了同样的问题,并认为这是从另一个域访问 RSS 提要的权限错误(可能是跨域?)。我能够在我的浏览器中提取 RSS 提要的内容。我对服务器的访问权限有限,而且它是高度安全的,所以我认为这是一些安全设置。
我发现这种替代方法可以让我解决这个问题:
Set xHttp = CreateObject("MSXML2.XMLHTTP")
xHttp.open "GET", "http://example.com/test.xml", False
xHttp.send
Set xd = Server.CreateObject("Microsoft.XMLDOM")
xd.loadxml(xHttp.responseText)
[rest of your code]
关于xml - 如何解决 "The download of the specified resource has failed"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12933511/