sidhu

sidhu

  • NA
  • 1
  • 0

[2.0] Evaluate and Compile methods in XpathNavigator class..why to use them? benfits any?

Aug 28 2006 4:54 PM

The following sample code is from MSDN.

XPathDocument document = new XPathDocument("books.xml");
XPathNavigator navigator = document.CreateNavigator();

XPathExpression query = navigator.Compile("sum(//price/text())");
Double total = (Double)navigator.Evaluate(query);
Console.WriteLine(total);

why should we Compile an XPath expression. The help file doesn't give any clear reasons for the usage of these two methods.

if any body have used these methods, please share your experience ..

thanks