rondog Posted April 17, 2009 Share Posted April 17, 2009 I am parsing an XML file in ASP. It appears you can't have an empty node or else I get this error: Microsoft VBScript runtime error '800a01a8' Object required: 'objHdl.childNodes(...).childNodes(...)' /post/resources/courses/DOP/vtod/index.asp, line 96 Sometimes the node will be populated other times it wont and I need to check that. Here is my code that is reading the XML and outputting html: Response.Write("<table width=""800"" cellpadding=""5"" cellspacing=""20"" border=""0"">" & vbCRLF) For i = 0 To (noOfHeadlines - 1) needFooter = true Set objHdl = objLst.item(i) if i mod numCols = 0 then Response.Write("<tr>") end if Response.Write("<td class=""courseTable"" valign=""top"" width=""33%"">" & vbCRLF &_ "<div id=""thumbs"" class=""thumb""><a tipcontent=""" & objHdl.childNodes(2).childNodes(0).text & """ href=""" & objHdl.childNodes(7).childNodes(0).text & """>" & vbCRLF &_ "<img id=""thumb_" & headlineNum & """ border=""0"" src=""" & objHdl.childNodes(5).childNodes(0).text & """ onmouseover=""hoveron(" & headlineNum & ");"" onmouseout=""hoveroff(" & headlineNum & ");""/>" & vbCRLF &_ "<div id=""playbtn_" & headlineNum & """ style=""position:relative; top: -80px; left: 0px; z-index:5; display:none;"">" & vbCRLF &_ "<img border=""0"" src=""images/btn-play-big.png"" onmouseover=""hoveron(" & headlineNum & ");"" onmouseout=""hoveroff(" & headlineNum & ");""/>" & vbCRLF &_ "</div></a></div>" & vbCRLF &_ "<span class=""chantitle""><a href=""" & objHdl.childNodes(7).childNodes(0).text & """>" & objHdl.childNodes(1).childNodes(0).text & "</a></span><br />" & vbCRLF &_ "<span class=""chanlength"">Length: " & objHdl.childNodes(6).childNodes(0).text & "</span><br />" & vbCRLF &_ "<span class=""chanstatus"">" & objHdl.childNodes(3).childNodes(0).text & "</span></td>" & vbCRLF)// <--- this is the line having issues with being null headlineNum = headlineNum + 1 if i mod numCols = numCols - 1 then Response.Write("</tr>") needFooter = false end if Next if needFooter then Response.Write("<td colspan=""" & numCols - (i mod numCols) & """></td></tr>") end if Response.Write("</table>") I've tried 'if Not isNull(the node)' and that didnt work. Anyone know how to do this? Link to comment https://forums.phpfreaks.com/topic/154433-solved-check-if-node-is-null-asp/ Share on other sites More sharing options...
rondog Posted April 17, 2009 Author Share Posted April 17, 2009 does anyone know?? Link to comment https://forums.phpfreaks.com/topic/154433-solved-check-if-node-is-null-asp/#findComment-812414 Share on other sites More sharing options...
rondog Posted April 20, 2009 Author Share Posted April 20, 2009 well if anyone is interested, this is the answer: if not (objHdl.childNodes(3).childNodes(0) is nothing) then courseStatus = objHdl.childNodes(3).childNodes(0).text end if Link to comment https://forums.phpfreaks.com/topic/154433-solved-check-if-node-is-null-asp/#findComment-814893 Share on other sites More sharing options...
Maq Posted April 20, 2009 Share Posted April 20, 2009 Great, this is solved then? Link to comment https://forums.phpfreaks.com/topic/154433-solved-check-if-node-is-null-asp/#findComment-814900 Share on other sites More sharing options...
rondog Posted April 20, 2009 Author Share Posted April 20, 2009 yes =) Link to comment https://forums.phpfreaks.com/topic/154433-solved-check-if-node-is-null-asp/#findComment-814903 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.