XPathNavigator.Compile : XPathNavigator « System.Xml.XPath « C# / C Sharp by API






XPathNavigator.Compile

  

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);
      }
  }
}

   
    
  








Related examples in the same category

1.XPathNavigator.Evaluate
2.XPathNavigator.Select