Generate class from schema with restrictions???

csharp , schema , code , generator MacKinney, United States
  • 12 years 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
  • 12 years ago
    Here is the schema sample ---
  • 12 years ago
    Here is the schema sample --- ` `
  • 12 years 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
  • 12 years 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).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“My definition of an expert in any field is a person who knows enough about what's really going on to be scared.” - P. J. Plauger