用经典ASP编写完整的XML文件
我从一个Web服务中获得一个XML文件,只需要打印整个XML文件,就像使用经典ASP XML文件读取:用经典ASP编写完整的XML文件,xml,asp-classic,Xml,Asp Classic,我从一个Web服务中获得一个XML文件,只需要打印整个XML文件,就像使用经典ASP XML文件读取: strURL = "http://www.google.com/ig/api?weather=" & weather & "&hl=" & hl set xmlDoc = createObject("MSXML2.DOMDocument") xmlDoc.async = False xmlDoc.setProperty "ServerHTTPRequest",
strURL = "http://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)
有没有一种简单的方法可以像Response.Write xmlDoc.XML或其他方法一样打印整个XML文件?
bLoaded.XML
将包含加载的XML
有关详细信息,请参阅文档
所以,是的:
Response.Write bLoaded.xml
将输出XML。您可能需要先对其进行HTML编码,并可能先对其进行漂亮的打印。一个鲜为人知的响应替代方法。编写是:
Response.ContentType = "text/xml"
Response.CharSet = "UTF-8"
xmlDoc.save Response
这会导致xmlDoc将xml直接写入响应流。这比生成由
xml
属性返回的Unicode字符串(仅将其重新编码到带有Response.Write的响应流中)的效率稍高。这对我来说很有效。。我能找到错误。。thx u@AnthonyWJones