Modifying code generated from XSD schema

CrazyPXT

New Member
I have some 5 XML calls to be implemented in C#.I used Xsd2Code to auto generate the code, and I am quite happy with the results.My problem, however, is that all the XML calls have same request response TypeName, as follows:XML Call - 1:\[code\]<Request Method="AvailabilityRetrievalRQ">....</Request><Response Method="AvailabilityRetrievalRS">....</Response>\[/code\]XML Call - 2:\[code\]<Request Method="RateRetrievalRQ">.....</Request><Response Method="RateRetrievalRS">....</Response>\[/code\]Thus, all 5 XML calls have generated 10 classes - 5 named "Request" and 5 named "Response".Now, I know that I can always specify the TypeName in XmlType as Request, and rename the classes. I have done that already.My question is if it is good to change the auto generated code or not. It's just renaming the classes. I haven't required to change anything else.Another solution I thought of is to give a difference C# namespace to each Request-Response pair. But I have a bad feeling about that, seeming more like a workaround.What, according to you, is the ideal solution?Another doubt is that I have same problem with the inner XML nodes. They have same name, but different funcationality, and hence different structure, in every XML call. For example,XML Call - 1\[code\]<Request Method="AvailabilityRetrievalRQ"> <Room ID="XXX" /> .....</Request>\[/code\]XML Call - 2\[code\]<Request Method="RateRetrievalRQ"> <Room ID="XXX" ProductID="YYY" /> ....</Request>\[/code\]Right now, I have decided not to try and take out common classes just to reduct code redundancy. I have preferred to keep the XSD schema mapped with the auto generated classes, and just renamed the classes so as to avoid any conflict. For example, the analogous Room classes for the above example would be:XML Call - 1\[code\]public partial class AvailabilityRetrievalRQ_Room { }\[/code\]XML Call - 2\[code\]public partial class RateRetrievalRQ_Room { }\[/code\]Am I doing wrong in that?
 
Back
Top