[Mono-list] Error while run program

Arx Henrique arxcruz@yahoo.com.br
Mon, 02 Aug 2004 22:03:42 -0300


Hi all,

Sorry my english one more time
I'm have problems with mono when i try run a example that i see in one
book, they compile correct but when i run show this error:

Unhandled Exception: System.NullReferenceException: Object reference not
set to an instance of an object
in <0x000bc> DotNetXmlSample.XmlSample:Main (string[])

i dont know what is this
somebody can help me ?

i use debian unstable with mono 1.0


this is the code:

using System;
using System.Xml;

namespace DotNetXmlSample
{
	public class XmlSample
	{
		static void Main(string[] args)
		{
			XmlDocument SampleDoc = new XmlDocument();
			XmlNode RootNode = null;
			XmlNode RegionNode = null;
			XmlNode RegionDescription = null;
			SampleDoc.Load("/home/ahcruz/teste.xml");
			RootNode = SampleDoc.DocumentElement;
			RegionNode = RootNode.ChildNodes[0];
			RegionDescription = RootNode.SelectSingleNode("description");
			RegionDescription.InnerText = "Reeeeeealy fast";
			SampleDoc.Save("/home/ahcruz/teste_2.xml");
		}
	}
}

And this is the xml file

<?xml version="1.0"?>
<links>
  <category xmlns="prog">
    <address>one addres</address>
    <description>one description</description>
  </category>
  <category xmlns="prog2">
    <address>two addres</address>
    <description>two description</description>
  </category>
</links>

thanks a lot of

Arx Henrique