469,328 Members | 1,327 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,328 developers. It's quick & easy.

DataSet to XML

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,
Joe
Nov 12 '05 #1
3 10097
Hi Joe,

"Joe98765" <jo***********@hotmail.com> wrote in message
news:44**************************@posting.google.c om...
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!


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
Nov 12 '05 #2
"Lars Wilhelmsen" <la*****@NOSPAM.ifi.uio.no> wrote in message news:<uf**************@tk2msftngp13.phx.gbl>...
Hi Joe,

"Joe98765" <jo***********@hotmail.com> wrote in message
news:44**************************@posting.google.c om...
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!


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?

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
then call the WriteXml method?
Nov 12 '05 #3
>
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
then call the WriteXml method?


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/bookst...sbn=0201758660
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jeronimo Bertran | last post: by
5 posts views Thread by Mike | last post: by
3 posts views Thread by JJ | last post: by
5 posts views Thread by Jason | last post: by
2 posts views Thread by John Holmes | last post: by
15 posts views Thread by JIM.H. | last post: by
16 posts views Thread by Geoff Jones | last post: by
22 posts views Thread by Arne | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.