XContainer.Descendants returns a collection of the descendant elements for this document or element, in document order. : XContainer « XML LINQ « VB.Net
XContainer.Descendants returns a collection of the descendant elements for this document or element, in document order.
Imports System
Imports System.Xml
Imports System.Xml.XPath
Public Class MainClass
Public Shared Sub Main()
Dim xmlTree As XElement = _
<Root Att1="AttributeContent">
<Child>Some text
<GrandChild>element</GrandChild>
</Child>
</Root>
Dim de = From el In xmlTree.Descendants _
Select el
For Each el In de
Console.WriteLine(el.Name)
Next
End Sub
End Class