Michel, do you actually *need* to have the schema included with your data? What are you doing with that data afterwards. If you can get by without using the schema (which, you should be able to, depending on what you're using it for), then all you need to do is return toDataSet.GetXml().
~~Bonnie
>>What are you doing with this Xml that you need to read it into a string? Read it into an XmlTextReader or an XmlDom to do something useful with it. XmlReader will read only a chunk at a time so it's very memory efficient but parsing is a bit difficult.
>>
>>There is no reason that I can think of to load Xml into a string.
>
>I am converting a DataSet to Xml:
>
>
> ' Convert a DataSet into an Xml
> ' This functions make it so the schema is included
> ' expO1 DataSet
> Public Function DataSetToXml(ByVal toDataSet As DataSet) As String
> Dim lcStreamReader As StreamReader
> Dim loMemorySteam As New MemoryStream()
> Dim loStringBuilder As StringBuilder = New StringBuilder()
>
> toDataSet.WriteXml(loMemorySteam, XmlWriteMode.WriteSchema)
> loMemorySteam.Seek(0, SeekOrigin.Begin)
> lcStreamReader = New StreamReader(loMemorySteam)
> loStringBuilder.Append(lcStreamReader.ReadToEnd())
> Return loStringBuilder.ToString
> End Function
>
>
>What kind of changes would you recommend to focus on that direction?