how to: re-assemble machine generated classes from xsd files to their original nested state.

Posted by Paul Connolly on Stack Overflow See other posts from Stack Overflow or by Paul Connolly
Published on 2010-04-01T09:57:40Z Indexed on 2010/04/01 10:03 UTC
Read the original article Hit count: 389

Filed under:
|
|
|

Hi everyone,

I'm working in Visual Studio 2008 using c#.

Let's say I have 2 xsd files e.g "Envelope.xsd" and "Body.xsd"

I create 2 sets of classes by running xsd.exe, creating something like "Envelope.cs" and "Body.cs", so far so good.

I can't figure out how to link the two classes to serialize (using XmlSerializer) into the proper nested xml, i.e:

I want: <Envelope><DocumentTitle>Title</DocumentTitle><Body>Body Info</Body></Envelope>

But I get: <Envelope><DocumentTitle>Title</DocumentTitle></Envelope><Body>Body Info</Body>

Could someone perhaps show me how the two .cs classes should look to enable XmlSerializer to runt the desired nested result?

Thanks a million

Paul

© Stack Overflow or respective owner

Related posts about xmlserializer

Related posts about xsd