Mega Code Archive

 
Categories / VB.Net / XML
 

Get attribute with namespace

Imports System Imports System.Xml Imports System.Xml.XPath Imports System.Collections Imports System.Collections.Generic Imports <xmlns:aw="http://www.domain.com"> Module Module1     Sub Main()         Dim xmlTree As XElement = <aw:Root aw:Att1="content1" aw:Att2="content2"/>         Dim attList As IEnumerable(Of XAttribute) = xmlTree.Attributes(GetXmlNamespace(aw) + "Att1")         For Each att In attList             Console.WriteLine(att)         Next     End Sub End Module