Hi Bonnie and Stephane,
Sorry for the mis-understanding about what you were looking for. Here is the solution I think you are wanting. This takes a DataSet and provides a string that contains the schema information as well as the data in xml format.
Dim sw As System.IO.StringWriter = New System.IO.StringWriter()
ds.WriteXml(sw, XmlWriteMode.WriteSchema)
Dim xmlString As String = sw.ToString()
>Hi Stephane,
>
>I saw your original question over on the VFP forum earlier today and I was trying to figure out exactly how to go about doing this. I didn't come up with anything elegant, so I gave up on it and decided not to reply to your question, since I didn't have a complete answer. But, I'm sure what you're looking for is the WriteXML() method.
>
>The DataSet.WriteXML() method has a means of writing an inline schema along with your data, and it has many overrides to write the XML in various formats (a file, a stream, etc) but unfortunately not a string (seems silly to me to have left this one out). I spent some time trying to figure out how to easily convert say, a stream, to a string but couldn't figure out how. I'm sorry I couldn't spend more time on trying to figure it out, but if you weren't already aware of the WriteXML() method, maybe this might point you in the right direction.
>
>Maybe Cathi will jump in here to save the day with sample code (as she usually does).
>
>~~Bonnie
>
>
>>Does anybody knows how to Create an inline XSD from a dataset. i can create the schema using DataSet.GetXmlSchema() and the XML with DataSet.GetXml() but how do i combine the two ?
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi