javascript - Not able to read the return values -
below code not reading return value readxml() in function matchvalue(). gives error in line log.message(myarr[1,1]);
function readxml() { var myarr; var doc = sys.oleobject("msxml2.domdocument.6.0"); doc.load("c:\\users\\sumit\\desktop\\sfsd.xml"); var nodes = doc.selectnodes("//config"); (i = 0; < nodes.length; i++){ var childnodes = nodes.item(i); myarr = new array(); myarr[i,i] = [nodes(i).childnodes(0).text, nodes(i).childnodes(1).text]; log.message(myarr[i,i]); } return myarr; } function matchvalue() { readxml(); log.message(myarr[1,1]); }
you're ignoring result of readxml()
when calling matchvalue()
save in variable able use result
var result = readxml()
Comments
Post a Comment