最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
网页上读取远程xml的数据
时间:2022-07-02 11:49:27 编辑:袖梨 来源:一聚教程网
一个客户提供一个股价的信息,要求放在页面上,显示一些数据,需要从远程获取xml,然后解析写在网页上,开始不会觉得很难,其实蛮简单的,先用javascript写了一个:
http://****.com/scripts/****.asp?subcode=C22 ,是客户提供的页面,其实是xml的内容,这里直接调用windows的组件进行读取,然后调用其中一个selectSingleNode的方法,读出last字段的内容;
VBscript也写了一个,其实差不多,不过有一点不同,asp中VB的不能直接读取远程xml的内容,很奇怪,不知道是不是由于VB的限制:
dim XMLMorntekDocument
Set http=Server.CreateObject("Microsoft.XMLHTTP")
http.Open "GET","http://****com/scripts/******.asp?subcode=C22",False
http.send
Set XMLMorntekDocument=Server.CreateObject("Microsoft.XMLDOM")
XMLMorntekDocument.Async=False
XMLMorntekDocument.ValidateOnParse=False
XMLMorntekDocument.Load(http.ResponseXML)
price = XMLMorntekDocument.selectSingleNode("//last").text
response.write price
Set http=Nothing
Set XMLMorntekDocument=Nothing
这里先用XMLHTTP的方法,get到xml文件,然后再解析。
作者Blog:http://blog.111**c*om.net/wumingwangzi/
http://****.com/scripts/****.asp?subcode=C22 ,是客户提供的页面,其实是xml的内容,这里直接调用windows的组件进行读取,然后调用其中一个selectSingleNode的方法,读出last字段的内容;
VBscript也写了一个,其实差不多,不过有一点不同,asp中VB的不能直接读取远程xml的内容,很奇怪,不知道是不是由于VB的限制:
dim XMLMorntekDocument
Set http=Server.CreateObject("Microsoft.XMLHTTP")
http.Open "GET","http://****com/scripts/******.asp?subcode=C22",False
http.send
Set XMLMorntekDocument=Server.CreateObject("Microsoft.XMLDOM")
XMLMorntekDocument.Async=False
XMLMorntekDocument.ValidateOnParse=False
XMLMorntekDocument.Load(http.ResponseXML)
price = XMLMorntekDocument.selectSingleNode("//last").text
response.write price
Set http=Nothing
Set XMLMorntekDocument=Nothing
这里先用XMLHTTP的方法,get到xml文件,然后再解析。
作者Blog:http://blog.111**c*om.net/wumingwangzi/
相关文章
- 塞尔达无双封印战记禁忌魔像boss战打法教学 禁忌魔像boss怎么打 12-24
- 企查查官网入口-官方正版查询入口 12-24
- 塞尔达无双封印战记武器封印解除方法 武器被封印了怎么办 12-24
- wifi万能钥匙如何轻松连接他人网络?wifi万能钥匙快速联网秘诀 12-24
- 携程官网登录入口-携程网官方网页版登录网址 12-24
- 塞尔达无双封印战记完美格挡技巧 怎么打出完美格挡 12-24