Mega Code Archive

 
Categories / VB.Net / XML LINQ
 

Extensions Descendants(T)

Imports System Imports System.Text Imports System.Xml Imports System.Xml.XPath Public Class MainClass     Public Shared Sub Main()         Dim xmlTree As XElement = _             <Root>                 <Para>                     <t>This is some text </t>                     <b>                         <t>where</t>                     </b>                     <t> text. </t>                 </Para>                 <Para>                     <t>This is a test.</t>                 </Para>             </Root>                  Dim str As String = (From el In xmlTree.<Para>...<t> Select CStr(el) ) _             .Aggregate(New StringBuilder(), _                        Function(ByVal sb, ByVal i) sb.Append(i), _                        Function(ByVal sb) sb.ToString())                  Console.WriteLine(str)     End Sub End Class