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