Mega Code Archive

 
Categories / C# / XML
 

XmlReader IsStartElement (String) tells if the current content node is a start tag or empty element tag

using System; using System.IO; using System.Xml; public class Sample {     public static void Main()     {         XmlReader reader = XmlReader.Create("book.xml");         while (reader.Read())         {             if (reader.IsStartElement("price"))             {                 Console.WriteLine(reader.ReadInnerXml());             }         }     } }