Combining enumeration and maxLength

Hello,

I would like to get your views on following (after some background info):

I work a lot with EDIFACT and MIGs (message implementation guides). I
write/use tools that transform EDIFACT messages to some XML format and
then use XML schema to validate syntax and content (to a certain extent).

In case you are not familiar with this message format: EDIFACT has many
data elements that use code lists (e.g. ISO country codes, but also
self-defined) and also always defines the data type for a data element,
e.g. 'an..3' would mean 'up to 3 alpha-numeric characters'.

Anyhow, I use a tool to build the XML format and eventually generate an
XML schema where you can set the data type and max length for a data
element. Aditionally you can define a code list to be used (optionally).
If a code list is defined the generated schema will contain enumeration
elements as restriction, if not there will be a maxLength element.

Now: if I define a code list that contains a value with 4 characters and
the max length is to be 3 then there would be no validation error because
there is no restriction of maxLength. I asked the developers of that tool
to consider combining enumeration and maxLength. They answered: Why would
you combine this? Either you have a list of values you consider as valid
or a maxLength. Good point I thought, but... here I am.

Is it a contradiction to combine enumeration and maxLength (and/or
minLength) as restriction or would it even be a good way to control/check
the enumeration values (well, you could blame the tool that it does not
check, but in case you don't use a tool).


Thanks for opinions and arguments,
Heiko

Received on Thursday, 21 April 2016 09:58:26 UTC