Mega Code Archive

 
Categories / VB.Net / XML LINQ
 

Replace content from XElement

Imports System Imports System.Reflection Imports System.Xml Module Module1     Sub Main()         Dim xml As XElement = XElement.Load("People.xml")         xml.Element("person").ReplaceNodes(New XElement("id", 5), _                                              New XElement("firstname", "A"), _                                              New XElement("lastname", "B"), _                                              New XElement("role", 1))         Console.WriteLine(xml)     End Sub End Module