using System; using System.Data; using System.Xml; using System.Xml.XPath; public class MainClass { public static void Main() { XPathDocument doc = new XPathDocument( "sample.xml" ); XPathNavigator nav = doc.CreateNavigator(); XPathExpression xpe = nav.Compile( "//name" ); XPathNodeIterator ni = nav.Select( xpe ); while ( ni.MoveNext() ) { Console.WriteLine(ni.Current.Value); } } }