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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check if an object is empty

Status
Not open for further replies.

kobyashi

Programmer
Apr 25, 2002
3
US
Hello,
I would like to select a node that may or may not exist from an xml
document and set it to an object in ASP.

Set detailNode =
xmlDoc.selectSingleNode("//Details/Detail[@id='1111']")
Response.Write detailNode.getAttribute("inputType")

The problem is that if the particular detail is not found, I get an
error -
- "Object required: 'detailNode'"
If I perform a check with IsObject(detailNode), it returns true so I
think
that my problem is that the object is empty. Is there a way to check
this? IsEmpty and IsNull do not seem to work.

Thanks
 
.. the infamous vb "three million types of nothing/null/crud" problem :(

I've had this problem b4, and I think you need to check if the object is nothing like this:

if detailNode is nothing then
.. code..
end if


isn't that the most annoying thing youve ever seen? it doesnt just happen with IXMLDomDocument, it happens with alot of objects too.

if is nothing doesnt work, try

if detailNode is null then
...
end if

hope that helps


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top