javascript.netxml

JS - using xmlDoc.selectNodes .. from .net


I have a JS which worked for years under Win10 and Win11 and contains these lines:

        var nsNodes = xmlDoc.selectNodes("//*/namespace::*");
var tmp="";
var nsNames=new Array();
var nsValues=new Array();
var nsInf=new Array();
for(var objNs = new Enumerator(nsNodes); !objNs.atEnd(); objNs.moveNext()) {
  var nAkt=objNs.item().Name+"="+objNs.item().Value;
  if (tmp.indexOf(nAkt) < 0) {
    tmp+=nAkt+"\r\n";
    var nTmp=objNs.item().Name.split(":");
......

Now on one PC after the other - depending on there current Windows update - the Script stops to work with the message

Die Eigenschaft "split" eines undefinierten oder Nullverweises kann nicht abgerufen werden. (xmlDoc.selectNodes(namespaces)) Try to translate: Property "split" of an undefined or null value can not be called ..

Now I found that "xmlDoc.Selectnodes" is called from .net-framework: javascript selectNodes on parsed xml

So I suppose that the current update of .net-framework causes this problem.

Anyone here who can verify or falsify my theory? Have a fine weekend!


Solution

  • The methods and properties of MSXML start with a lower case letter (and your code uses e.g. async, load, selectNodes). For some reason I don't understand when you are trying to access properties of nodes you use .Name and .Value where, in the case sensitive world of JScript, I think you need .name and .value. That is what I suggest to try.