Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP XML Using ASP 3 and XML. See also the XML category for more XML discussions not relating to ASP. NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 14th, 2004, 03:08 AM
Authorized User
 
Join Date: Oct 2004
Location: , , India.
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Default Null Exception while reading

Dear All,

i am facing Null Exception when I try to read from XML Document and no value is assigned.Can any one suggest some function like ISDbNull for reading from Document for specific value.

Thanks

Amit

  #2 (permalink)  
Old December 14th, 2004, 05:15 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Amit,

Can you post your code and identify the line where the error occurs?

Thanks,

Chris

  #3 (permalink)  
Old December 14th, 2004, 06:08 AM
Authorized User
 
Join Date: Oct 2004
Location: , , India.
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear Chris,

Thank you for replying promptly.

I am receving information from XML Document in a stream and is fetching specific information from it using Document Object of type MSXML2.DOMDocument and its method -
.SelectSingleNode("xml...nodes").Text same as we do from Database.

The error "System.NullReferenceException" is generated if I try to read value if the node is empty in XML Document.

I am not able to check by any method if value is empty the same as the method is available for Database ISDBNULL.

Hope to hear soon.

Thanking you in advance.

Regards

Amit
  #4 (permalink)  
Old December 14th, 2004, 06:20 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Amit,

You should be able to try to select the element you are after & then check whether you have a node before accessing the Text property, e.g.
Code:
Dim myText: myText = ""
Dim myEl: Set myEl = .SelectSingleNode("xml...nodes")
If Not myEl Is Nothing Then
    myText = myEl.Text
End If
HTH,

Chris



Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript: null or not an object exception ganeshbraj ASP.NET 1.0 and 1.1 Professional 0 September 28th, 2007 08:01 AM
Null Reference Exception was unhandled labby C# 2005 1 February 9th, 2007 03:15 PM
Null reference exception when using DataAdapter Samantha Karen Webb C# 1 July 21st, 2006 09:12 AM
NULL reference exception Dwizz VB.NET 2002/2003 Basics 3 June 21st, 2005 07:15 AM
null exception error abhit_kumar JSP Basics 4 January 5th, 2005 05:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.