Read XML File Using XMLReader in C#

 string Title="";
        string Description="";
        string Date="";
        string Link="";
           string fixpath = HttpContext.Current.Server.MapPath("~\\uploads\\\news.xml");
           using (XmlReader reader = XmlReader.Create(fixpath))
           {
               while (reader.Read())
               {
                   if (reader.IsStartElement())
                   {
                       switch (reader.Name.ToString())
                       {
                           case "title":
                               Title = reader.ReadString();
                               break;
                           case "Description":
                               Description = reader.ReadString();
                               break;
                           case "date":
                               Date = reader.ReadString();
                               break;
                           case "link":
                               Link = reader.ReadString();
                               break;
                       }
                   }
               }
           }

Related Alrticles

FREE!!! Registration