When XPath does not return a node or nodeset

11 Aug 2005

When using an aggregate XPath function like sum or avg, you can't use the methods SelectSingleNode or SelectNodes of the XmlDocument object. The aggregate functions return a scalar value and not a node or node-set (hence the reason the methods can't be used). A simple way around this is to use the XPathNavigator object. XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); XPathNavigator exp = ...

Read it all ยป