Option Explicit
Option Strict
Imports System
Imports System.IO
Imports System.Xml
Public Class Sample
Private Shared filename As String = "sampledata.xml"
Public Shared Sub Main()
Dim writer As XmlTextWriter = Nothing
writer = New XmlTextWriter(filename, Nothing)
writer.Formatting = Formatting.Indented
writer.WriteStartElement("schema")
writer.WriteAttributeString("xmlns", Nothing, "http://www.w3.org/2001/XMLSchema")
writer.WriteAttributeString("xmlns", "po", Nothing, "http://domain.com/po")
writer.WriteStartElement("element")
writer.WriteAttributeString("name", "purchaseOrder")
writer.WriteStartAttribute(Nothing, "type", Nothing)
writer.WriteQualifiedName("data", "http://domain.com/po")
writer.WriteEndAttribute()
writer.WriteEndElement()
writer.WriteEndElement()
writer.Flush()
writer.Close()
Dim doc As New XmlDocument()
doc.PreserveWhitespace = True
doc.Load(filename)
Console.Write(doc.InnerXml)
End Sub
End Class