XmlConvert.VerifyWhitespace
Imports System
Imports System.Xml
Public Class Sample
Public Shared Sub Main()
Dim writer5 As XmlTextWriter = New XmlTextWriter("outFile.xml", Nothing)
Dim illegalWhiteSpaceChar As Char = "_"
Try
writer5.WriteStartElement("root")
writer5.WriteStartElement("legalElement")
writer5.WriteString("ValueText" + XmlConvert.VerifyWhitespace(" " + illegalWhiteSpaceChar))
writer5.WriteEndElement()
writer5.WriteEndElement()
writer5.Close()
Catch e As XmlException
Console.WriteLine(e.Message)
writer5.Close()
End Try
End Sub
End Class
Related examples in the same category