XPathNavigator.Evaluate (String, IXmlNamespaceResolver)
Imports System
Imports System.Xml
Imports System.Xml.XPath
Public Class MainClass
Public Shared Sub Main()
Dim document As XPathDocument = New XPathDocument("domainBooks.xml")
Dim navigator As XPathNavigator = document.CreateNavigator()
Dim manager As XmlNamespaceManager = New XmlNamespaceManager(navigator.NameTable)
manager.AddNamespace("bk", "http://www.domain.com/books")
Dim total As Double = CType(navigator.Evaluate("sum(descendant::bk:book/bk:price)", manager), Double)
Console.WriteLine("Total price for all books: {0}", total.ToString())
End Sub
End Class
Related examples in the same category