S
Spencer
I am working on a program that uses System.Xml and an XML file. I have
the following code in my project that returns a NullReferenceException:
profileDataDoc = new XmlDocument();
profileDataDoc.Load(fileName);
XmlElement root = profileDataDoc.DocumentElement;
XmlNode GoalNode = root.SelectSingleNode("/Profile_Data/Profile
[ProfileName=Spencer]/GoalWeight");
MessageBox.Show(GoalNode.Value); <---- NullReferenceException
The debugger says "Object reference not set to an instance of an
object" on the MessageBox.Show line. I know the string is correct
against the xml file.
Can anyone help with why it is saying this? GoalNode is properly
instantiated, isn't it?
Thanks again,
Spencer
--
the following code in my project that returns a NullReferenceException:
profileDataDoc = new XmlDocument();
profileDataDoc.Load(fileName);
XmlElement root = profileDataDoc.DocumentElement;
XmlNode GoalNode = root.SelectSingleNode("/Profile_Data/Profile
[ProfileName=Spencer]/GoalWeight");
MessageBox.Show(GoalNode.Value); <---- NullReferenceException
The debugger says "Object reference not set to an instance of an
object" on the MessageBox.Show line. I know the string is correct
against the xml file.
Can anyone help with why it is saying this? GoalNode is properly
instantiated, isn't it?
Thanks again,
Spencer
--