cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
anom217
Level 8

XML Node error

I'm trying to create an InstallScript function that will parse through a XML file and retrieve the value of an attribute. But whenever I try to create a node, it fails.


set oDoc = CreateObject("Microsoft.XMLDOM");
if(IsObject(oDoc) = FALSE) then
MessageBox("MSXML DOM-Document Connection Failed" , 0);
return -1;
endif;
oDoc.async = FALSE;
oDoc.setProperty("SelectionLanguage", "XPath");
oDoc.load(svFile);
try
set oNodeList = oDoc.getElementsByTagName("*");
catch
MessageBox("Error creating node list", SEVERE);
return -1;
endcatch;

if(oNodeList.length = 0) then
MessageBox("No matching elements found", 0);
return -1;
endif;

for ii = 0 to (oNodeList.length - 1);
try
set oNode = oNodeList.nextNode;
catch
MessageBox("Couldn't assign node", SEVERE);
endcatch;
try
svAttributeValue = oNode.attributes.getNamedItem(svAttribute).value;
catch
svAttributeValue = "";
endcatch;
endfor;


There is an exception thrown when
set oNode = oNodeList.nextNode;

is called. The nodeList has several nodes, I've printed out their names to be sure. But for some reason, it won't create the node object itself!

This is the content of my sample xml file.





Anyone have any idea why the node object fails to create?
Labels (1)
0 Kudos
(1) Reply
anom217
Level 8

I'm still having this issue...and I can't seem to figure out what's going wrong. Anyone else had a similar problem?
0 Kudos