Build the query to get all nodes that are in the www.yourDomain.com namespace. : Namespace « XML LINQ « VB.Net






Build the query to get all nodes that are in the www.yourDomain.com namespace.

  
Imports System
Imports System.Xml.Linq
Imports <xmlns:gfh="www.yourDomain.com">
    Public Class MainClass

        Public Shared Sub Main()
            Dim employees As XElement = XElement.Load("EmployeesWithNS.xml")

            Dim gfhEmployees = From ele In employees.Descendants _
                               Order By ele.<Name>.Value() _
                               Where (ele.Name.Namespace = GetXmlNamespace(gfh)) _
                               Select ele.<Name>.Value()
            For Each emp In gfhEmployees
                Console.WriteLine(emp)
            Next
        End Sub

    End Class

   
    
  








Related examples in the same category