MSXML4 and selectSingleNode

  • Thread starter Marja Ribbers-de Vroed
  • Start date
M

Marja Ribbers-de Vroed

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?
 
M

Martin Honnen

Marja said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,170
Latest member
Andrew1609
Top