var objArgs = WScript.Arguments; if (WScript.Arguments.Count() ==0)...{ showUsage(); }else...{ processFile(WScript.Arguments(0)); } function showUsage()...{ WScript.Echo("**************************************************************************** " +"A sample for iterating a xml tree " +"Usage: xmlDom.js your_file1 " +"****************************************************************************"); WScript.Quit(); } function processFile(source)...{ var xmlTree=new ActiveXObject("Microsoft.XMLDOM"); xmlTree.async="false"; if (!xmlTree.load(source)) ...{ WScript.Echo( "Failed to load file as XML. "+ xmlTree.parseError.url +":"+ xmlTree.parseError.line +""+ xmlTree.parseError.reason); } var xmlRoot = xmlTree.documentElement; WScript.Echo(xmlRoot.nodeName); WScript.Echo(xmlRoot.attributes[0].name); for (i =0; i < xmlRoot .childNodes.length; i++) ...{ WScript.Echo(xmlRoot .childNodes[i].nodeName); WScript.Echo(xmlRoot .childNodes[i].xml); } }