Topic "XML Parsing to VBS"

Author Message
fick

Guest


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='http://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);
}
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
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License