Imports System
Imports System.Xml
Public Class Sample
Public Shared Sub Main()
Dim writer as XmlTextWriter = new XmlTextWriter ("out.xml", nothing)
Dim tag as string = "item name"
try
writer.WriteStartElement("root")
writer.WriteStartElement(XmlConvert.VerifyName(tag))
catch e as XmlException
Console.WriteLine(e.Message)
writer.WriteStartElement(XmlConvert.EncodeName(tag))
end try
writer.WriteString("hammer")
writer.WriteEndElement()
writer.WriteEndElement()
writer.Close()
End Sub
End Class