Community discussion forum

Generate class from schema with restrictions???

  • 9 months ago
    Hi I am designing an XSD schema in which there is a field called SSN. This field has some restrictions like maxlength, type, format etc. All that is described in schema itself. Schema sample attached. Now, I generate a C# class out of this schema using XSD.exe or XSDGen tool. They do create a class but none of them incorporates the restrictions (validation) specified in schema. Basically, I want object class to have a way to validate those restrictions. How can I generate a class from schema which also includes the restriction on fields? Thanks Pankaj
    Post was edited on 25/02/2009 15:53:27 Report abuse
  • 9 months ago
    Here is the schema sample ---
  • 9 months ago
    Here is the schema sample --- ` `
  • 9 months ago
    Hi, I have wanted to do this myself, but found that it can't be done, simply because the standard types in the language don't support things like regex patterns. To get around it, i validated all input against the XSD afterwards to make sure it was inputted correctly. Regards Si
  • 9 months ago
    Thanks for the response. It does make sense. Though I wonder, when will it be available in .NET platform.

Post a reply

Enter your message below

Sign in or Join us (it's free).

We'd love to hear what you think! Submit ideas or give us feedback