Using XPath to test if XML node exists
Posted on 2004-09-15
Using ASP, I'm trying to access specific XML nodes with .SelectSingleNode("//TAGNAME") and test if the tag exists. Accessing the nodes (when they exist) is no problem, but the test for existance has me stumped.
set thisNode = xmlDoc.documentElement.SelectSingleNode("//TAGNAME")
If StrComp("thisNode.Text", "" )<> 0 Then
but it gives me an 'object required' error
Should I use getElementsByTagName() instead?
I'm sure this is not a very difficult question for you experts, but I'm stuck on this and a quick solution is very important, so I'm assigning more points.