Hi I wrote my code for updating of an existing XML,The XML updates the values that get from a data table code as follows
XML
<NewDataSet>
 <Table>
    <ID>22709</ID>
    <Name>PRODUCT</Name>
    <SerialNo>941</SerialNo>
     </Table>
   </NewDataSet>
Has to be updated with the data table(dataSource) values
ID Name SerialNo
1  Abc  234
public void UpdateXML(DataTable dtSourceData)
     {
         try
         {
             XmlDocument doc = new XmlDocument();
             doc.Load(@"E:\Mahi\Source.xml");
             XmlNode ID = doc.DocumentElement["ID"];
             ID .FirstChild.InnerText = dtSourceData.Rows[0]["ID"].ToString();
             XmlNode Name = doc.DocumentElement["Name"];
             Name.FirstChild.InnerText = dtSourceData.Rows[0]["Name"].ToString();
             XmlNode SerialNo = doc.DocumentElement["SerialNo"];
             SerialNo.FirstChild.InnerText = dtSourceData.Rows[0]["SerialNo"].ToString();
             doc.Save(@"E:\Mahi\Source.xml");
         }
         catch(Exception ex)
         {
             throw ex;
         }
    }
I am getting Object reference error at updating ID part.
