when do I need xml schema to handle xml serialization

  • Thread starter Thread starter Tony Johansson
  • Start date Start date
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
 
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.
 
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
 
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
 
Back
Top