Imports System
Imports System.Reflection
Imports System.Xml
Module Module1
Sub Main()
Dim reader As XmlReader = XmlReader.Create("People.xml")
Dim xml As XDocument = XDocument.Load(reader)
Console.WriteLine(xml)
Dim idperson As XElement = xml.Descendants("person").Last()
idperson.Add(New XElement("id", _
New XAttribute("id", 1), _
New XAttribute("year", 2006), _
New XAttribute("salary", "1")))
Dim sw As New IO.StringWriter()
Dim w As XmlWriter = XmlWriter.Create(sw)
xml.Save(w)
w.Close()
Console.WriteLine(sw.ToString())
End Sub
End Module
|