hi ....
i am trying to add a new node to an existing xml file in c# ..........
the code is as follows:
XmlDocument doc = new XmlDocument();
string filename = @"C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\xml\xml\bin\Debug\bookstore.xml";
//create a new node
XmlElement newbook = doc.CreateElement("book");
//set attribute
newbook.SetAttribute(label1.Text, textBox1.Text);
//create new element
XmlElement npublication = doc.CreateElement(label2.Text);
npublication.InnerText = textBox2.Text;
newbook.AppendChild(npublication);
XmlNode xn = doc.DocumentElement;
xn.AppendChild(newbook);
i get this message "Object reference not set to an instance of an object."
please help me out