网络编程 
首页 > 网络编程 > 浏览文章

利用ASP从远程服务器上接收XML数据的方法

(编辑:jimmy 日期: 2024/9/22 浏览:3 次 )
复制代码 代码如下:<% 
dim objXML 
dim objRootElement 
dim strValue 
dim strInetURL 
dim strXML 
dim item             
strInetURL ="http://pf.inetsolution.com/inetactive2001/inetactive2001news.xml" 
Dim HttpReq  
set HttpReq = server.CreateObject("MSXML2.XMLHTTP")   
HttpReq.open "GET", "http://pf.inetsolution.com/inetactive2001/inetactive2001news.xml", False 
HttpReq.send 
strXML = HttpReq.responseText        
Set objXML = Server.CreateObject("Msxml2.DOMDocument") 
objXML.validateonparse = true 
objXML.async=false 
objXML.loadXML(strXML) 
if objXML.ParseError.errorCode <> 0 then 
    Response.Write("Error: " & objXML.parseError.reason & "<br>") 
    Response.Write("Code: 0x" & hex(objXML.parseError.errorCode) & "<br>") 
    Response.Write("At Line: " & objXML.parseError.line & "<br>") 
    Response.Write("At pos: " & objXML.parseError.linePos & "<br>")                 
else 
    set objRootElement = objXML.documentElement 
    if not isObject(objRootElement) then 
        Response.Write("no file loaded") 
    else 
        Response.Write(objRootElement.childnodes(0).text) 
    end if 
end if 
%> 
上一篇:Dom遍历XML的一个例子,结果为树状结构
下一篇:实例演练ASP+XML编程比较全的了第1/2页
一句话新闻
Windows上运行安卓你用过了吗
在去年的5月23日,借助Intel Bridge Technology以及Intel Celadon两项技术的驱动,Intel为PC用户带来了Android On Windows(AOW)平台,并携手国内软件公司腾讯共同推出了腾讯应用宝电脑版,将Windows与安卓两大生态进行了融合,PC的使用体验随即被带入到了一个全新的阶段。
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网 SiteMap