Mega Code Archive

 
Categories / VB.Net / XML LINQ
 

Add XAttribute with namespace to XElement

Imports System Imports System.Xml Imports System.Xml.Schema Class MainClass     Shared Sub Main()         Dim aw As XNamespace = "http://www.domain.com"         Dim root As XElement = New XElement(aw + "Root", _             New XAttribute("xmlns", "http://www.domain.com"), _             New XElement(aw + "Child", "content") _         )         Console.WriteLine(root)     End Sub End Class