![]() |
| ||
| appending a new node to am existing xml file 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 |
| All times are GMT -4. The time now is 4:12 pm. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC