Dim doc = XDocument.Load("D:\TEMP\Sample.xml") For Each site In doc.<DataPath>.<Site> site.SetAttributeValue("Location", "d") Next 'MsgBox(doc.ToString()) doc.Save("D:\TEMP\Sample2.xml")