如何用经典ASP编写一个完整的XML文件?
- 内容介绍
- 文章标签
- 相关推荐
本文共计153个文字,预计阅读时间需要1分钟。
从Web服务获取XML文件,仅需打印经典ASP接收到的整个XML文件。读取XML文件:
strURL=http://www.google.com/ig/api?weather= + weather + &hl= + hlsetxmlDoc=createObject(MSXML2.DOMDocument)xmlDoc.async=False
我从一个Web服务获得一个 XML文件,只需要打印经典ASP收到的整个XML文件.XML文件读取:
strURL = "www.google.com/ig/api?weather=" & weather & "&hl=" & hl set xmlDoc = createObject("MSXML2.DOMDocument") xmlDoc.async = False xmlDoc.setProperty "ServerHTTPRequest", true bLoaded = xmlDoc.load(strURL)
有没有一种简单的方法来打印整个XML文件,如Response.Write xmlDoc.xml或其他方式?
对Response.Write的一个较少知道的替代是:Response.ContentType = "text/xml" Response.CharSet = "UTF-8" xmlDoc.save Response
这会导致xmlDoc将xml直接写入响应流.这比生成xml属性返回的Unicode字符串稍微更有效,只是使用Response.Write将其重新编码为响应流.
本文共计153个文字,预计阅读时间需要1分钟。
从Web服务获取XML文件,仅需打印经典ASP接收到的整个XML文件。读取XML文件:
strURL=http://www.google.com/ig/api?weather= + weather + &hl= + hlsetxmlDoc=createObject(MSXML2.DOMDocument)xmlDoc.async=False
我从一个Web服务获得一个 XML文件,只需要打印经典ASP收到的整个XML文件.XML文件读取:
strURL = "www.google.com/ig/api?weather=" & weather & "&hl=" & hl set xmlDoc = createObject("MSXML2.DOMDocument") xmlDoc.async = False xmlDoc.setProperty "ServerHTTPRequest", true bLoaded = xmlDoc.load(strURL)
有没有一种简单的方法来打印整个XML文件,如Response.Write xmlDoc.xml或其他方式?
对Response.Write的一个较少知道的替代是:Response.ContentType = "text/xml" Response.CharSet = "UTF-8" xmlDoc.save Response
这会导致xmlDoc将xml直接写入响应流.这比生成xml属性返回的Unicode字符串稍微更有效,只是使用Response.Write将其重新编码为响应流.

