Mega Code Archive

 
Categories / VB.Net / XML
 

Extensions Attributes returns a collection of the attributes of every element in the source collection

Imports System Imports System.Xml Imports System.Xml.XPath Public Class MainClass     Public Shared Sub Main()         Dim xmlTree As XElement = _             <Root xmlns:aw="http://www.domain.com" Att1="content1" Att2="content2">                 <Child1 Att1="content3" Att2="content4"/>                 <Child2 Att1="content5" Att2="content6"/>             </Root>                  Dim attList = _             From att In xmlTree.DescendantsAndSelf.Attributes _             Select att                  Console.WriteLine(xmlTree)                  For Each att As XAttribute In attList             Console.WriteLine(att)         Next     End Sub End Class