Use XPath to get the tasks for each employee. : XPath « XML LINQ « VB.Net






Use XPath to get the tasks for each employee.

   

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")

        End Sub

    End Class

   
    
    
  








Related examples in the same category

1.Loop through the query results and display the information to the screen.
2.Selecting node by XPath
3.Evaluates an XPath expression, resolving namespace prefixes using the specified IXmlNamespaceResolver.
4.Selects a collection of elements using an XPath expression.
5.XPathExpression Class provides a typed class that represents a compiled XPath expression.
6.Selects a collection of elements using an XPath expression.