Use XPathDocument if you have plan to work with XPath Queries rather than XmlDocument

Don't use the XmlDocument class if you are going to work with XPath queries. .NET has its own class for this purpose called XPathDocument, which does not run any validation checking. When using XPath, avoid using to reduce the search, because searches the complete document.

XPathDocument Doc = new XPathDocument(FileName);
XPathNavigator nav = Doc.CreateNavigator();
XPathNodeIterator Iterator = nav.Select("/bookstore/book");
while (Iterator.MoveNext())
{
   Console.WriteLine(Iterator.Current.Name);
}

Comments

Popular posts from this blog

Convert XElement to DataTable

Enable mouse scroll-wheel in VB6

C# code to Check IE Proxy Settings