Create XmlWriter using XmlWriter.Create method.
Imports System.Xml
Imports System.Xml.Serialization
Imports System.IO
Public Class MainClass1
Public Shared Sub Main()
Dim settings As New XmlWriterSettings()
settings.Indent = True
settings.IndentChars = " "
Using writer As XmlWriter = XmlWriter.Create("books.xml", settings)
writer.WriteStartElement("book")
writer.WriteElementString("price", "9.9")
writer.WriteEndElement()
writer.Flush()
End Using
End Sub
End Class
Related examples in the same category