Mega Code Archive

 
Categories / C# / XML
 

Moves to the next attribute

using System; using System.IO; using System.Xml; public class Sample {     public static void Main()     {         XmlTextReader reader = null;         reader = new XmlTextReader("attrs.xml");         if (reader.HasAttributes)         {             Console.WriteLine("Attributes of <" + reader.Name + ">");             while (reader.MoveToNextAttribute())             {                 Console.WriteLine(" {0}={1}", reader.Name, reader.Value);             }         }     } }