Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
XML
data.xmlanalysis
mappoint.webservice
msf
msxml-webrelease
netmyservices.sdk
passport.sdk
soap
soapsdk
uddi.general
uddi.programming
uddi.specification
xml
xmlsqlwebrelease
xsl
  
 
date: Wed, 2 Apr 2008 13:11:12 -0700 (PDT),    group: microsoft.public.xml        back       


Error with selectSingleNode in VBScript to VB6 convert   
Hi everybody,

I need some assistance with the following VBScript. I need to convert
this into running under VB6 and has no idea as to why it keeps falling
oover on line no 5.

Would appreciate it if help could be given in this respect.

Thanks

----------------------------------------------------
1 Dim oDOM As New DOMDocument
2 Dim oDOMOut As New DOMDocument

3 Dim sXML

4      Call oDOM.Load("Vehicle.xml")

5          oDOM.selectSingleNode("//schemeid").Text = "1"
6          oDOM.selectSingleNode("//dateofbirth").Text = "21 jun 1970"
7          oDOM.selectSingleNode("//genderid").Text = "1"

8          sXML = x.QuoteWithPath(oDOM.XML, "")

9  oDOMOut.loadXML sXML
10 Debug.Print sXML

11 nNewPremium = oDOMOut.selectSingleNode("//grosspremium").Text

12 Set x = Nothing
13 Set oDOM = Nothing
14 Set oDOMOut = Nothing
-------------------------------------------------------------
date: Wed, 2 Apr 2008 13:11:12 -0700 (PDT)   author:   ASPDeveloper

Re: Error with selectSingleNode in VBScript to VB6 convert   
your code is not safe .
if oDom.selectSingleNode can't find the node , it will return Nothing . and 
Nothing hasnot the text property .

may be you can try this

dim xdn
set xdn=  oDOM.selectSingleNode("//schemeid")
if Not(xdn is nothing) then
    xdn.Text="1"
else
   err.raise ,,"can't fiind node schemeid!"
end if
set xdn=  oDOM.selectSingleNode("//dateofbirth")
if Not(xdn is nothing) then
    xdn.Text="1"
else
   err.raise ,,"can't fiind node dateofbirth!"
end if
.
.
date: Thu, 3 Apr 2008 09:40:50 +0800   author:   smartcatiboy

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us