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 = _
aaaText
cccTextddd
Dim nodes As IEnumerable(Of XNode) = _
From node In xmlTree..DescendantNodes _
Select node
For Each node As XNode In nodes
Select Case node.NodeType
Case XmlNodeType.Element
Console.WriteLine("Element: {0}", DirectCast(node, XElement).Name)
Case XmlNodeType.Text
Console.WriteLine("Text: {0}", DirectCast(node, XText).Value)
Case XmlNodeType.Comment
Console.WriteLine("Comment: {0}", DirectCast(node, XComment).Value)
Case XmlNodeType.ProcessingInstruction
Console.WriteLine("PI: {0}", DirectCast(node, XProcessingInstruction).Data)
End Select
Next
End Sub
End Class