Object Does Not Support Property Or Method: "<> NULL"

liunx

Guest
The ASP page I'm working on keeps throwing this error: "Object doesn't support this property or method"

The line it references is this: "While xmlNode <> NULL". I have no idea why this line would be throwing this error, as there is no property or method being called.

The full sub:


Sub buildBox( name )
Dim xmlNode 'used to get a particular node

For Each xmlItem In xmlNodes
Set xmlNode = xmlItem.firstChild
While xmlNode <> NULL
If xmlNode.name = name Then
Response.Write "<option"
If Request( "submit" ) Then
If xmlNode.text = Request( name ) Then
Response.Write " selected"
End If
End If
Response.Write ">" & xmlNode.text & "</option>" & vbNewline
End If
xmlNode = xmlNode.nextSibling
Wend
Next
End Sub


The purpose of this sub is to read in the elements of an XML file and build select boxes from all the elements of a given name (there can be multiple entries per record with this name). xmlNodes is declared elsewhere on the page, and is an array that contains all the XML nodes from the document.

Oh, and if I remove the word "Set" from the declaration, than that line shows as the error (same error).

Any thoughts?

Rysyou a JAVA developer? :P

ASP doesn't have a NULL constant like other languages (such as JAVA - took a bit for me to get used to also).

Instead, they have a isNull(variable) function where you just pass in your variable and it'll return either true or falseNo. To be honest, I'm not sure where I got NULL from. JavaScript, maybe. I'll give your suggestion a try, though.

RysOkay, I think I've got the thing working, except for one stupid little flaw. How, in ASP, do you test is a variable exists or contains information? My while loop doesn't seem to be picking up on when a variable hits the end of the available data.

RysNull is in VBScript but its not the same as NULL in other languages, thats why it can't be compared.

you must use the IsNull functionTo test for valid states of information you can use the Is* functions

like IsArray,IsDate,IsNull,IsObject,IsEmpty,IsNumeric. If the object isEmpty then its equal to Nothing.

Somethings will get you tho. Like an null terminated string is still numeric, equal to 0, a date of 1/1/102 BC is valid it VB but not MS-SQL. You can't compare values to null. Thats why IsNull is there. Usually this is a result of how VB handles it... <> is a bit comparision operand, however if it is null then it checks the memory location, which it will never be equal to.The IsNull function worked for me, thanks. It's working now.

Rys
 
Back
Top