Shoutbox

XML - check if node exists - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: XML - check if node exists (/showthread.php?tid=63944)

XML - check if node exists by deAd on 07-25-2006 at 01:49 AM

Is there a way using the 'Microsoft.XMLDOM' activexobject to check if a particular node exists? right now I'm using try/catch but there's got to be a better way...


RE: XML - check if node exists by cooldude_i06 on 07-25-2006 at 02:37 AM

code:
var node = xmlDoc.documentElement.selectSingleNode("Nodename");
if(nodeUser) Debug.Trace("Node exists.");
else Debug.Trace("Nodes does not exist.");

You can also look for nodes with specific properties

code:
var node = xmlDoc.documentElement.selectSingleNode("NodeName[@PropertyName='PropertyValue']");