XmlTextWriter.Formatting Property indicates how the output is formatted.
Option Explicit
Option Strict
Imports System
Imports System.IO
Imports System.Xml
Public Class Sample
Public Shared Sub Main()
Dim writer As XmlTextWriter = Nothing
writer = New XmlTextWriter(Console.Out)
writer.Formatting = Formatting.Indented
writer.Indentation = 4
writer.WriteStartElement("book")
writer.WriteStartElement("title")
writer.WriteString("C#")
writer.WriteEndElement()
writer.WriteEndElement()
writer.Close()
End Sub
End Class