From: Marja Ribbers-de Vroed on
The following is a code snippet of a classic ASP webapplication:

Set l_oNode = p_oXML.selectSingleNode(l_sXPath)
If (Not IsNull(l_oNode)) Then
l_sValue = l_oNode.text
End If

According to http://www.devguru.com/Technologies/xmldom/quickref/node_selectSingleNode..html the selectSingleNode method should return Null when no node was found for the XPath expression, but it doesn't. At least not in a way that satisfies the "Not IsNull()" test.

The program always tries to execute l_sValue = l_oNode.text which obviously results in errors when the node was not found.

What am I missing?

--
Marja
From: Martin Honnen on


Marja Ribbers-de Vroed wrote:

> The following is a code snippet of a classic ASP webapplication:
>
> Set l_oNode = p_oXML.selectSingleNode(l_sXPath)
> If (Not IsNull(l_oNode)) Then

Compare the result of selectSingleNode to the value Nothing e.g.
If Not l_oNode Is Nothing Then

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/