You can use DataSet.GetXML()
Dim column As DataColumn
For Each column In DataSet.Tables.Item(0).Columns
column.ColumnMapping = MappingType.Attribute
Next
Dim xml As String = DataSet.GetXml()
It is not related to XmlWriter but you can use it for formatting XML.