' 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.IO
Imports System.Text
Imports System.Xml

Class MainClass
    Public Shared Sub Main(ByVal args As String())
        Dim xtw As XmlTextWriter = New XmlTextWriter("C:\test3.xml", Encoding.UTF8)
        xtw.Formatting = Formatting.Indented
        xtw.WriteStartDocument
        xtw.WriteStartElement("all")
        Dim i As Integer
        For i = 1 To 5
            xtw.WriteStartElement("one")
            xtw.WriteString("Element #" & i)
            xtw.WriteEndElement
        Next
        xtw.WriteEndElement
        xtw.WriteEndDocument
        xtw.Close
    End Sub
End Class 
