XPathNavigator.Evaluate dvaluates XPath expression and returns the typed result.
Imports System
Imports System.Xml
Imports System.Xml.XPath
Public Class MainClass
Public Shared Sub Main()
Dim document As XPathDocument = New XPathDocument("books.xml")
Dim navigator As XPathNavigator = document.CreateNavigator()
Dim total As Double = CType(navigator.Evaluate("sum(descendant::book/price)"), Double)
Console.WriteLine(total.ToString())
End Sub
End Class