Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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
2  
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
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

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.