Wednesday, March 13, 2013

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())

No comments:

Post a Comment