Object reference not set to an instance of an object.
Object reference not set to an instance of an object. when i try to update my xml document
my xml files is :
<?xml version="1.0" encoding="utf-8"?>
<News12>
<Category id="1">
<News1>
<News>
My name is mohammed shamsheer.I am working in poloysys
</News>
</News1>
</Category>
</News12>
code behind :
protected void btnUpdate_Click(object sender, EventArgs e)
{
XmlDocument UpdateXmlDocument = new XmlDocument();
UpdateXmlDocument.Load(Server.MapPath("XMLFile2.xml"));
XmlNodeList UpdateNodeList;
UpdateNodeList = UpdateXmlDocument.SelectNodes("/News12/Category[@id='1']");
UpdateNodeList[0].ChildNodes[2].InnerText = "Asp.net";
}
}