XML Parsing to VBS

Advertisement

fick
Guest

XML Parsing to VBS

Do you have this script in VBS?
// parse XML log file
var doc = new ActiveXObject("MSXML2.DOMDocument");
doc.async = false;
doc.load("log.xml");

doc.setProperty("SelectionNamespaces",
"xmlns:w='https://winscp.net/schema/session/1.0'");

// look for file tags
var nodes = doc.selectNodes("//w:file");

WScript.Echo("There are " + nodes.length + " files and subdirectories:");

// list the files
for (var i = 0; i < nodes.length; ++i)
{
var filename = nodes[i].selectSingleNode("w:filename/@value").value;
WScript.Echo(filename);
}

Reply with quote

Advertisement

fick
Guest

NVM.. got it. Thanks.

dim objShell

Set objShell = WScript.CreateObject("Wscript.Shell")

set xmlDoc=CreateObject("Microsoft.XMLDOM")
xmlDoc.async="true"
xmlDoc.load("zeta.xml")

Set colNodes=xmlDoc.selectNodes _
("//upload/destination/@value")

For Each objNode in colNodes
Wscript.Echo objNode.Text
Next

Reply with quote

Advertisement

You can post new topics in this forum