문제

I am using the XML DOM loadXML method.

How can I return the entire XML file to a variable after doing this? I know how to parse the XML; I just want the entire XML file as a single chunk of text assigned to a variable. I've scanned the XML DOM Properties but cannot find anything that does this specific task.

Essentially, I want to be able to set varXML = xml.getContents (of course, getContents isn't a real property).

I'm receiving the XML via the Request method using VBScript; VBScript won't allow setting a variable to Request.

Is my only option parsing it out node by node? Surely there is a way to get the entire XML at once?

도움이 되었습니까?

해결책

Use the .xml property of the Msxml2.DOMDocument:

>> Dim objMSXML : Set objMSXML = CreateObject("Msxml2.DOMDocument")
>> objMSXML.loadXml "<a>b</a>"
>> WScript.Echo objMSXML.xml
>>
<a>b</a>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top