Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xmlDoc, childNode, nodeName - if not exist then error, so how to skip?

Status
Not open for further replies.

fletchsod

Programmer
Dec 16, 2002
181
0
0
I can't help it if the Credit Bureaus xml data is random. I get the "Object variable or with variable not set" error when one of the childNodes or nodeName doesn't have this xml tag. So, in order to avoid the error, I need to be able to detect the xml tag as whether does it exist or not, if not exist then skip it. So, how do you guys do that?

Code:
        'Get Credit Score for Individual (this xml tags is compatible with Equifax, Experian and Trans Union)...
        sJunkStr = oXmlDoc2.childNodes(0).childNodes(0).childNodes(4).childNodes(iNode_I).childNodes(15).childNodes(0).childNodes(1).nodeName
        If UCase(sJunkStr) = "SCORE" Then
            sScore_I = oXmlDoc2.childNodes(0).childNodes(0).childNodes(4).childNodes(iNode_I).childNodes(15).childNodes(0).childNodes(1).Text
            [Score #1].Value = sScore_I
        End If
 
Have a look at the On Error instruction and the Err object.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top