This code is so handy that I'm posting it just to remember. I preffer to serialize my datasets as attributes instead of elements. And its just a matter of using a setting. See:
Dim cnPubs As New SqlConnection("Data Source=<servername>;user id=<username>;" & _
"password=<password>;Initial Catalog=Pubs;")
Dim daAuthors As New SqlDataAdapter("Select * from Authors", cnPubs)
Dim ds As New DataSet()
cnPubs.Open()
daAuthors.Fill(ds, "Authors")
Dim dc As DataColumn
For Each dc In ds.Tables("Authors").Columns
dc.ColumnMapping = MappingType.Attribute
Next
ds.WriteXml("c:\Authors.xml")
Console.WriteLine("Completed writing XML file, using a DataSet")
Console.Read()