' Collection of code snippets by Arne Vajhøj 
' (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
Imports System
Imports System.Xml

Class MainClass
    Public Shared Sub Main(ByVal args As String())
        Dim doc As XmlDocument = New XmlDocument
        Dim root As XmlNode = doc.CreateElement("all")
        doc.AppendChild(root)
        Dim i As Integer
        For i = 1 To 5
            Dim elm As XmlNode = doc.CreateElement("one")
            elm.AppendChild(doc.CreateTextNode("Element #" & i))
            root.AppendChild(elm)
        Next
        doc.InsertBefore(doc.CreateXmlDeclaration("1.0", "UTF-8", "yes"), doc.DocumentElement)
        doc.Save("C:\test2.xml")
    End Sub
End Class 
