Different ways of using xpath query within C#
I havent used xpath in months (years?) and I was looking at a few examples
UsesXPathNavigator andXPathNodeIterator
http://www.codeproject.com/soap/myXPath.asp
Using SelectSingleNode
http://www.mastercsharp.com/article.aspx?ArticleID=69&&TopicID=9
Is the 2nd listing the old way of doing it under the 1.1 framework ?
[673 byte] By [
BitShift] at [2007-12-26]
No, XPathNavigator can be implemented over different stores, .NET 1.x and .NET 2.0 have it over XPathDocument, XmlDocument and XmlDataDocument and allow it to be implemented over other stores if someone wants to do it. MSDN has some examples I think e.g. XPathNavigator over .NET objects structures.
In .NET 1.x SelectSingleNode is a method around in the .NET DOM implementation (System.Xml.XmlDocument, XmlNode), together with SelectNodes, somehow following the MSXML DOM API which also has selectSingleNode/selectNodes methods. With .NET 2.0 XPathNavigator for convenience also has a SelectSingleNode method.
What you want to use depends on your needs and experience, if you have already use selectSingleNode or selectNodes with MSXML and you want to use XmlDocument in .NET then SelectSingleNode/SelectNodes will be familiar. If you want to use a general XPath navigation that works on other stores then you should look into XPathNavigator.
XPathNavigator also allows you to evaluate XPath expressions that do not return a node set but rather yield a boolean or number or string value.