XElement.SetAttributeValue sets the value of an attribute, adds an attribute, or removes an attribute.
Imports System Imports System.Xml Imports System.Xml.XPath Public Class MainClass Public Shared Sub Main() Dim root As XElement = <Root/> root.SetAttributeValue("Att1", 1) root.SetAttributeValue("Att2", 2) root.SetAttributeValue("Att3", 3) Console.WriteLine(root) root.SetAttributeValue("Att2", 22) Console.WriteLine(root) root.SetAttributeValue("Att3", Nothing) Console.WriteLine(root) End Sub End Class