Loop through the query results and display the information to the screen.
Imports System
Imports System.Xml.Linq
Imports System.Xml.XPath
Public Class MainClass
Public Shared Sub Main()
Dim employees As XElement = XElement.Load("EmployeesAndTasks.xml")
Dim xpathQuery = employees.XPathSelectElements("/Employee/Tasks/Task")
For Each task In xpathQuery
Console.WriteLine("{0,-15} - {1} ({2})", task.Parent.Parent.<Name>.Value, task.<Name>.Value, task.<Description>.Value)
Next
End Sub
End Class
Related examples in the same category