XContainer.DescendantNodes returns a collection of the descendant nodes
Imports System
Imports System.Xml
Imports System.Xml.XPath
Public Class MainClass
Public Shared Sub Main()
Dim xmlTree As XElement = _
<Root Att1="AttributeContent">
<Child>
<GrandChild>element</GrandChild>
</Child>
</Root>
Dim dnas = From node In xmlTree.DescendantNodes _
Select node
For Each node In dnas
If TypeOf node Is XElement Then
Console.WriteLine(DirectCast(node, XElement).Name)
Else
Console.WriteLine(node)
End If
Next
End Sub
End Class