Groups | Blog | Home
all groups > dotnet xml > july 2004 >

dotnet xml : DataSet to XML


joesmith98765 NO[at]SPAM hotmail.com
7/12/2004 11:32:52 AM
I have data coming from SQL Server and need to write out some XML. I
have a schema(xsd) for this XML file. Right now I am bringing in the
DataSet and writing out the elements and attributes myself using
xmltextwriter to match schema without really using the xsd at the time
of writing.

The file I create validates but I was wondering is there a better way?
I see things like inferschema method off of dataset, can this be used?
How do you map columns in a dataset with elements and attributes in
the schema? I know dataset.WriteXmL will write XML but that match my
schema. Appreciate any help!

Thanks,
joesmith98765 NO[at]SPAM hotmail.com
7/12/2004 5:11:06 PM
[quoted text, click to view]


Sorry, let me clarify...as I mistyped "I know dataset.WriteXML will
write XML but that DOESN'T match my schema".

dataset.writexml would be great...but how do you get it to write xml
based on a existing schema? Is there a way to associate an existing
schema and map my columns in the dataset to elements/attributes and
Lars Wilhelmsen
7/12/2004 8:44:35 PM
Hi Joe,

[quoted text, click to view]

I find it a bit hard to grasp your problem - you want to write out the
DataSet as
xml - and you want it to validate against your schema - but you don't want
to
use the dataset.WriteXml() that actually writes out conforming xml !?

Is it speed/other performance issues you're troubling with?

--
Lars Wilhelmsen
http://www.sral.org/
Software Engineer
Teleplan A/S, Norway

Mark Bosley
7/12/2004 10:52:25 PM
[quoted text, click to view]

I think you are not framing your question quite right. Validation based on a
schema happens during the reading, not writing.

A truely wonderful free reference is the sample chapter from Bob
Beauchemin's
Essential ADO.Net

http://www.awprofessional.com/bookstore/product.asp?isbn=0201758660

AddThis Social Bookmark Button