Re: Combining enumeration and maxLength

I don't think it's a "contradiction" to combine an enumeration list with other facets such as maxLength or pattern. It might be redundant, but it's not contradictory, and there might be good reasons for it if the authority responsible for the general rules (e.g. maxLength) is different from the authority for the more specific rules (the enumeration).

I would be inclined to do it by defining one type containing the general rules for values, e.g. maxLength or pattern, and then restricting this (optionally) with another type that defines more specific rules, eg. an enumeration.

Michael Kay
Saxonica

> On 21 Apr 2016, at 10:23, Heiko Niemann <kontakt@heiko-niemann.de> wrote:
> 
> 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 10:09:35 UTC