Imports System
Imports System.Xml
Imports System.Xml.XPath
Imports System.Collections
Imports System.Collections.Generic
Public Class MainClass
Public Shared Sub Main()
Dim xmlTree As XElement = _
Some textelement content
Dim dnas As IEnumerable(Of XNode) = _
From node In xmlTree.DescendantNodesAndSelf() _
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