Add the new node to the bottom of the XML tree
Imports System
Imports System.Xml.Linq
Public Class MainClass
Public Shared Sub Main()
Dim employees As XElement = XElement.Load("Employees.xml")
Dim newEmployee = <Employee id=<%= 1 %>>
<Name>First</Name>
<Title>Coder</Title>
<HireDate>07/15/2006</HireDate>
<HourlyRate>9.95</HourlyRate>
</Employee>
employees.Add(newEmployee)
For Each ele In employees.<Employee>
ele.Add(<TerminationDate></TerminationDate>)
ele.Add(New XAttribute("Status", ""))
Next
Console.WriteLine(employees.ToString())
End Sub
End Class
Related examples in the same category