when do I need xml schema to handle xml serialization

T

Tony Johansson

Hi!

My question is simple if I'm going to serialize an object do I also need to
have an xml schema that define the structure of the xml ?
If yes what is the normal way to create an xml schema ?

//Tony
 
M

Martin Honnen

Tony said:
My question is simple if I'm going to serialize an object do I also need to
have an xml schema that define the structure of the xml ?

No, if you have .NET classes you can simply use certain attributes to
control XML serialization but you don't need a schema.
If yes what is the normal way to create an xml schema ?

If you start with an XML instance document and if you want to
_deserialize_ that XML instance document and want to use xsd.exe to
generate .NET class code to represent the XML then you first need an XML
schema. But xsd.exe can generate that from the XML instance document too.
 
A

Arne Vajhøj

My question is simple if I'm going to serialize an object do I also need to
have an xml schema that define the structure of the xml ?
If yes what is the normal way to create an xml schema ?

No. Not with an out-of-the-box serialization.

If you use a custom serialization, then a schema
would be an excellent documentation of the format.

Arne
 
T

Tony Johansson

Martin Honnen said:
No, if you have .NET classes you can simply use certain attributes to
control XML serialization but you don't need a schema.


If you start with an XML instance document and if you want to
_deserialize_ that XML instance document and want to use xsd.exe to
generate .NET class code to represent the XML then you first need an XML
schema. But xsd.exe can generate that from the XML instance document too.

Assume that I have an XML instance document how do I create an XML schema
from which I can then create a
..NET class ?

//Tony
 

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