Jump to content

Recommended Posts

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.