all groups > dotnet xml > june 2006 >
You're in the

dotnet xml

group:

XPath performance


XPath performance Jon
6/29/2006 11:17:02 AM
dotnet xml:
I got a question on executing the xpath. Can someone let me know which way is
faster for the following two scenarios (one with XmlDocument and the other
using XmlDocument.CreateNavigator())?

XmlDocument doc = new XmlDocument();
doc.Load(input);

1. XmlNodeList nodes = doc.SelectNodes(xpathexp);
Re: XPath performance Priya Lakshminarayanan
6/29/2006 4:05:12 PM
The doc.SelectNodes is a convenience method that in turn calls
this.CreateNavigator().Select(xpath)
Note that XPathNavigator.Select returns an XPathNodeIterator and not an
XmlNodeList and hence the doc.SelectNodes internally creates an
XmlNodeList() that is returned.

Thanks,
Priya

[quoted text, click to view]

Re: XPath performance Jon
6/29/2006 7:26:01 PM
So doc.CreateNavigator().Select(xpathexp) should be faster since it does not
need to build the NodeList. Is it true?

[quoted text, click to view]
AddThis Social Bookmark Button