Yuan Yijun (bbbush) wrote,
Yuan Yijun
bbbush

zz:Null Object is not Null but Nothing in vbscript

http://p2p.wrox.com/archive/asp_xml/2002-12/7.asp


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..

Marc.



Marc,
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...

HTH,
Carlos.



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

Marc.



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

  • 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…

  • Crime and Punishment

    As a step to improve the illiterate situation I joined the Basic Program this year. It had been in my mind for a couple years, but glad this time I…

  • zz:Firefox Monitor found your email in a new data breach

    5/26/2020 breach happened after LiveJournal became active on Twitter since this week -- coincidence?

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments