日期:2014-05-16  浏览次数:20991 次

Asp处理xml问题
http://www.youdao.com/smartresult-xml/search.s?type=mobile&q=13888880000这个是有道的手机归属地查询接口,返回的是xml,我想将其归属地结果显示出来,该如何处理呢

------解决方案--------------------
set xhr=Server.CreateObject("microsoft.xmlhttp")
xhr.open "get","http://www.youdao.com/smartresult-xml/search.s?type=mobile&q=13888880000",false
xhr.send
rst=xhr.responsetext
set xhr=nothing

set rx=new regexp
rx.pattern="<location>([\s\S]+?)</location>"
if rx.test(rst) then
  set m=rx.Execute(rst)
  response.write m.item(0).submatches(0)
end if

set rx=nothing