Select a node : XmlPathNavigator : XML C# Examples


C# Examples » XML » XmlPathNavigator »

 

Select a node









    
using  System;
using  System.Xml.XPath;
using  System.Xml;

class  MainClass
{
    static  void  Main(string[]  args)
        {
                XmlDocument  xmlDoc  =  new  XmlDocument();
                xmlDoc.Load(@"c:\books.xml");
        
                XPathNavigator  nav  =  xmlDoc.CreateNavigator();

                Console.WriteLine("Author  First  Name");
                XPathNodeIterator  itrator  =  nav.Select("descendant::first-name");                  
                while(  itrator.MoveNext()  )
                {
                        Console.WriteLine(itrator.Current.Value.ToString());
                }
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo XML
» XmlPathNavigator