Yuan Yijun (bbbush) wrote,
Yuan Yijun

zz:Null Object is not Null but Nothing in vbscript


lo all

I've tried to run some xmldom scripts and am facing a problem with the "null" returned by the selectSingleNode method..

The doc says it will return null when the node is not found but i've made some tests with existing errors and i couldn't compare the result to Null..


In vb/vbscript selectSingleNode() returns a value of nothing. You have to
check for the Nothing value. Ex:

Set Node = objXMLDoc.documentElement.selectSingleNode("SomeNodeName")
If Node Is Nothing Then
Response.Write "SomeNodeName not found."
End If

Using IsObject() will not work, because Nothing is an object...


thx it works fine..i was misslaid by the reference.. :)
i'll try to keep in mind that null for an object is Nothing..


如果是 javascript 就一切皆对象 if(temp){...}
可是现在写这么恶心的东西.. if not temp is nothing then... 谁让它和 COM 绑得那么紧呢。
Tags: 工作, 转载

  • 2020

    Last time I wrote a review was in 2018, about 2017. Or maybe I wrote something elsewhere, maybe on Twitter? It was hard to write something freely…

  • #thotcon badge?

    [root@m4700 ~]# esptool write_flash 0x00000 /home/yuan/tracking/thotcon0x9/tc0x9.bin esptool.py v2.3.1 Connecting.... Detecting chip type...…

  • Portfolio weighted averages

    Last week I got an assignment to make a small Java library for some often used portfolio calculations. A portfolio is a collection of holdings, each…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded