Posts

Showing posts from March, 2017

Reading XML tag Values using Programmatically

Get the XML tag values  1. Create Constants.xml file and create the tags in the below format. <?xml version="1.0" encoding="utf-8" ?> <ConstantsXML>   //This is used as identifier to read the data from inside of the identified tag from Code <Constants> <EmpName> Employee Name </EmpName> <EmployeeID> Employee Id </EmployeeID> <EmpDepartment> Department </EmpDepartment> </Constants> </ConstantsXML> 2. Declaring the Variables   #region Members         static String elementValue;         private static readonly String ConstantNodeIdentifier = "ConstantsXML";         private static XDocument m_sourceDocument;   #endregion 3. Method to Read the XML Document form the Specified Path static Constant()         {             try             {                 if (System.IO.File.Exists(HostingEnvironment.MapPath("~/Common/Configuration.xml")))