如何用经典ASP技术生成完整的XML文档?
- 内容介绍
- 文章标签
- 相关推荐
本文共计149个文字,预计阅读时间需要1分钟。
我从Web服务获取一个XML文件,只需打印ASP收到的整个XML文件。XML文件读取代码如下:javascriptstrURL=http://www.google.com/ig/api?weather= + weather + &hl= + hlset;xmlDoc=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将其重新编码为响应流.
本文共计149个文字,预计阅读时间需要1分钟。
我从Web服务获取一个XML文件,只需打印ASP收到的整个XML文件。XML文件读取代码如下:javascriptstrURL=http://www.google.com/ig/api?weather= + weather + &hl= + hlset;xmlDoc=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将其重新编码为响应流.

