XmlSchemaClassGenerator icon indicating copy to clipboard operation
XmlSchemaClassGenerator copied to clipboard

Required Attribute for MinOccurs

Open pavan1386 opened this issue 5 years ago • 3 comments

Hi, I've started using this tool instead of xsd.exe and so far it has been a godsend. However, I notice that the "minOccurs", "maxOccurs" restrictions are not reflected on the generated classes (no [required] attribute or similar). Is this part of the functionallity?

Thank you.

pavan1386 avatar May 14 '20 00:05 pavan1386

This functionality is not present currently.

mganss avatar May 14 '20 10:05 mganss

Possibly relevant is noting how xsd.exe implements this :

https://stackoverflow.com/a/16971203/1040437

jzabroski avatar Jul 18 '23 02:07 jzabroski

It looks like RequiredAttribute is implemented as of now.

At least we have it generated on minOccurs="1" even if there's string tag.

Having [Required] messes up with mentioned earlier issue (https://stackoverflow.com/a/16971203/1040437) where you end up with error on empty string data like <SomeTag/>.

Is it somehow intentional?

strigefleur avatar Feb 14 '24 14:02 strigefleur

@strigefleur What's the issue with the way it's currently implemented? How can it be fixed?

mganss avatar May 14 '24 15:05 mganss