I have a loop that loops through an XML when I come to the node1 there might be some that don't have a value (i). I tried to use a if statement to catch the value thats blank
XML info
ElementTag.Node1 well have node2 and node3 under it
then there would be another ElementTag.Node1 with node2 and node3 under it.
Is there a why to handle a empty value in a loop
I get this error
Microsoft VBScript runtime error '800a01a8'
Object required: 'item(...)'
/XML/showxml2.asp, line 49
Dim Cyear
Dim Cnumber
Dim Ctitle
Set objLst1 = xml.getElementsByTagName("node1")
Set objLst2 = xml.getElementsByTagName("node2")
Set objLst3 = xml.getElementsByTagName("node3")
For i = 0 to (objLst.length - 1)
if objLst1.item(i).text = "" then
response.write hello
else
Cyear = objLst1.item(i).text
end if
Cnumber = objLst2.item(i).text
Ctitle = objLst3.item(i).text
Response.Write Cyear
Response.Write Cnumber
Response.Write Ctitle
Next
Set xml = Nothing
XML info
ElementTag.Node1 well have node2 and node3 under it
then there would be another ElementTag.Node1 with node2 and node3 under it.
Is there a why to handle a empty value in a loop
I get this error
Microsoft VBScript runtime error '800a01a8'
Object required: 'item(...)'
/XML/showxml2.asp, line 49
Dim Cyear
Dim Cnumber
Dim Ctitle
Set objLst1 = xml.getElementsByTagName("node1")
Set objLst2 = xml.getElementsByTagName("node2")
Set objLst3 = xml.getElementsByTagName("node3")
For i = 0 to (objLst.length - 1)
if objLst1.item(i).text = "" then
response.write hello
else
Cyear = objLst1.item(i).text
end if
Cnumber = objLst2.item(i).text
Ctitle = objLst3.item(i).text
Response.Write Cyear
Response.Write Cnumber
Response.Write Ctitle
Next
Set xml = Nothing