Hello everyone,
I am using xsd to generate a C# class from an XML file. I noticed there are a couple of fields of the generated classes are marked with various XML attribute, like XML attribute and XML element.
Now I want to add more restrictions to the input XML file during deserialization,
- Make some fields in the C# class not nullable during serialization;
- Make some fields to accept only numbers (currently the automatic generated C# file is using string type other than number type to represent the fields).
Any ideas about how to decorate the generated C# class file to achieve the goal?
thanks in advance,
George

Guest UserRank #1,422 · 1.2K reputationPosted Jan 6, 2009, 5:28 AM EST
George GeorgeRank #1,736 · 870 reputationPosted Jan 10, 2009, 3:35 AM EST
Thanks John! It is a good start-point for me. But I can not find any good samples for those methods for me to begin code. Could you provide some pseudo code or refer to some online samples to learn?
regards,
George