Write XML File using XmlTextWriter

Imports System.Xml
Module Module1

    Sub Main()

        Dim xmlWriter As New XmlTextWriter("C:\productNames.xml", System.Text.Encoding.UTF8)
        With xmlWriter
            .WriteStartDocument(True)
            .WriteStartElement("data", "test")

            .WriteElementString("item", "test", "Prod0")
            .WriteElementString("item", "test", "Prod1")

            
            .WriteEndElement()
            .WriteEndDocument()
            .Close()
        End With

    End Sub

End Module

转载于:https://www.cnblogs.com/yangbin990/archive/2006/12/27/605223.html

你可能感兴趣的:(Write XML File using XmlTextWriter)