XmlTextWriter.WriteWhitespace writes out the given white space.
Option Strict
Option Explicit
Imports System
Imports System.IO
Imports System.Xml
Public Class Sample
Public Shared Sub Main()
Dim writer As XmlTextWriter = Nothing
writer = New XmlTextWriter("ws.html", Nothing)
writer.WriteStartElement("p")
writer.WriteAttributeString("xml", "space", Nothing, "preserve")
If writer.XmlSpace = XmlSpace.Preserve Then
Console.WriteLine("xmlspace is correct!")
End If
writer.WriteString("something")
writer.WriteWhitespace(" ")
writer.WriteElementString("b", "B")
writer.WriteString("ig")
writer.WriteEndElement()
writer.Close()
End Sub
End Class
Related examples in the same category