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

  • 资本主义

    1. 资本如果有 300% 回报就命都不要了,当上总统的回报相比余生,岂止 300% 2. 大家反对的是让有钱人得偿所愿。如果是普通人当上总统是最好,就算是政客也需要众筹。突然出现一个自己有能力负担竞选开支的人,正说明了金钱无所不能,正是理智的人害怕的事情 3.…

  • zz:回来后,一些搞不懂的“共识”

    http://www.mitbbs.com/article_t/Returnee/13379685.html 共识一:欧美搞设计、掌握技术和市场,中国只会生产。利润都被欧美赚走了。 但是结果是中国越来越有钱,欧美越来越没钱,这算是共识吗? 共识二:中国贫富差距大,钱都被少数人赚去了;…

  • 医改提议:从市场化到证券化

    题目太大,想法很简单。如果从就医等于花钱的角度去想问题,资源永远不够,怎么搞都会有人反对。如果把就医看作投资就不一样,医患之间就是全新的关系。投资的花花肠子非常多。量化,打包组合,自主选择,尤其是投资组合的概念非常重要。证券市场让经济更有效率,不把其中的经验用起来就可惜了。…

  • 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