Mega Code Archive

 
Categories / VB.Net / XML LINQ
 

Create new Xml document with XDocument and XElement

Imports System Imports System.Reflection Imports System.Xml Module Module1     Sub Main()         Dim xml1 As New XDocument(New XDeclaration("1.0", "UTF-8", "yes"), _                     New XElement("people", _                     New XAttribute("id", 1), _                     New XAttribute("year", 2004), _                     New XAttribute("salar", "1")))         Dim sw As New System.IO.StringWriter()         xml1.Save(sw)         Console.WriteLine(sw)     End Sub End Module