[xsd-users] Mapping for string-based enumerations: string constructors?

Boris Kolpackov boris at codesynthesis.com
Wed Mar 11 09:01:46 EDT 2015


Hi Yury,

Yury Zaytsev <yury.zaytsev at traveltainment.de> writes:

> I'm not quite sure of what's the use case for allowing arbitrary
> strings?

There is no use-case. It is that dis-allowing them, in the general
case, is not as straightforward as one may think.

Firstly, this is a programming error that will only be detected
at runtime. Already bad news. There will be a performance
penalty. Things get even worse once you consider inheritance of
enumerations (yes, those things can inherit). Without some
special double-check avoidance mechanism, this will be double
(or triple, for two levels of inheritance, etc) performance
penalty. So, overall, I don't consider this worth the extra
complexity.

The only solution that I am willing to entertain is an option
that will disable the generation of these additional c-tors
(but watch out for default attribute value initialization).

Boris



More information about the xsd-users mailing list