Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inline XSD
Message
General information
Forum:
ASP.NET
Category:
ADO.NET
Title:
Miscellaneous
Thread ID:
00736764
Message ID:
00736804
Views:
15
Cathi,

Well, no wonder I couldn't figure it out ... the docs for WriteXML mention absolutely nothing about being able to output a string via StringWriter. And Intellisense for WriteXML doesn't have it listed in the overloads either. Of course, I never actually tried it (until just now). I figured if it wasn't in Intellisense then that parameter type didn't exist. Silly me!! <g>

~~Bonnie



>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 ?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform