One question about XML schemas

P

Piotrekk

Hi
I was reading a lot about DataSets and XML schemas ( xsd )
None of the sources has answered my question - when should we use
schemas? Usually when i save and load dataset to/from XML I don't need
to create schemas.
What is the real life example of when we should create schemas for an
XML representation of database set.

Best regards
Piotr Ko³odziej
 
N

Nicholas Paldino [.NET/C# MVP]

Piotr,

Well, if you are going to expose that data set through say, a web
service, you would need the schema then. But for just regular exposure in a
program, I would say you don't need it really.

You could also use it to validate other data set instances that you want
to perform some sort of merge operation on.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi
I was reading a lot about DataSets and XML schemas ( xsd )
None of the sources has answered my question - when should we use
schemas? Usually when i save and load dataset to/from XML I don't need
to create schemas.
What is the real life example of when we should create schemas for an
XML representation of database set.

Best regards
Piotr Ko³odziej
 
M

Mythran

Piotrekk said:
Hi
I was reading a lot about DataSets and XML schemas ( xsd )
None of the sources has answered my question - when should we use
schemas? Usually when i save and load dataset to/from XML I don't need
to create schemas.
What is the real life example of when we should create schemas for an
XML representation of database set.

Best regards
Piotr Ko³odziej

What's really nice about including a schema for a DataSet is that you can
have the VS.Net automatically generate a typed dataset from that schema
(xsd) file. What the typed dataset generator does is create a set of
classes in the language you are using (granted, the generator is configured
for your language) that represent the xsd schema as a DataSet descendant.
The primary dataset class that is generated inherits from
System.Data.DataSet and extends DataTable and DataRow classes by adding
properties for fields, an IsFieldNameHereNull method for each field that is
nullable, and several other methods that make working with the typed
dataset/table/rows much more intuitive. You will no longer have to access
each field using the Rows(ColumnName/Index/Column) property of the DataRow.

HTH,
Mythran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top