XmlTextWriter.WriteWhitespace writes out the given white space. : XmlTextWriter « XML « VB.Net






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

1.XmlTextWriter.Close closes this stream and the underlying stream.
2.XmlTextWriter.Flush
3.XmlTextWriter.Formatting Property indicates how the output is formatted.
4.XmlTextWriter.Indentation
5.XmlTextWriter.WriteCData writes out a block
6.XmlTextWriter.WriteCharEntity Method forces the generation of a character entity for the specified Unicode character value.
7.XmlTextWriter.WriteEndElement closes one element and pops the corresponding namespace scope.
8.XmlTextWriter.WriteFullEndElement closes one element and pops the corresponding namespace scope.
9.XmlTextWriter.WriteQualifiedName Method writes out the namespace-qualified name
10.XmlTextWriter.WriteRaw Method writes raw markup manually from a string.
11.Verifies name according to the W3C Extended Markup Language recommendation.