Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A .NET/C# system receives XML messages for processing and further transmission.

Since working directly on XML documents would be very inconvenient, it is necessary to deserialize the message to a C# object and then serialize just before delivery.

Up until now this has been done with Microsoft's XSD tool (xsd.exe) and it gets the job done, but poorly. The tool is old and buggy and generates outrageous class names and code representations of the various XML schema constructs.

Are there better ways to accomplish this in .NET, or should I go a whole other way about it?

share|improve this question
Are you wanting to generate a class based on the XML dynamically or do you know what fields are coming in from the XML? – Chad La Guardia Mar 20 '11 at 4:03
Nothing dynamic. The XML schemas are static so the classes are only generated once. – lox Mar 23 '11 at 9:00

Unless there is an insane amount of properties, or the classes are changing on the fly, I just hand-write a POCO to handle deserialization. It is a bit of up-front investment, but if these objects are being used I like to have my naming conventions, etc., in place.

share|improve this answer
+1 same here. I rarely generate them unless it's a ridiculously huge doc – CaffGeek Mar 25 '11 at 16:38

If you're using Visual Studio (I'm guessing this is likely), then check out xsd2code.

I haven't used it in a while though so my memory might be a bit fuzzy, but it may just be a VS plugin wrapper around XSD.exe. Give it a shot though.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.