XmlTextReader : Xml Atrributes : XML C# Examples


C# Examples » XML » Xml Atrributes »

 

XmlTextReader









    
using  System;
using  System.Xml;

class  MainClass
{
    static  void  Main(string[]  args)
    {
        XmlTextReader  reader  =  new  XmlTextReader(@"C:\books.xml");
        
        while  (reader.Read())
        {
            if  (reader.HasAttributes)
            {
                Console.WriteLine(reader.Name  +  "  Attribute");
                for  (int  i  =  0;  i  <  reader.AttributeCount;  i++)
                {
                    reader.MoveToAttribute(i);
                    Console.WriteLine("Nam:  "+reader.Name  +",  Value:  "+  reader.Value);
                }
                reader.MoveToElement();  
            }        
        }

    }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo XML
» Xml Atrributes