Description
Say we have a schema like this:
<element name="file" dfdl:lengthKind="explicit" dfdl:length="16" dfdl:lengthUnits="bits"> <simpleType> <restriction base="xs:string"> <maxLength value="2" /> </restriction> </simpleType> </element>
So we have a 2-byte constant length string and we specify maxLength should be 2. However, because we specify the length in bits, the value of dfdl:length is greater than the value of maxLength and so we output a warning:
[warn] Schema Definition Warning: Explicit dfdl:length of 16 is out of range for facet maxLength='2'. (id: facetExplicitLengthOutOfRange)
The issue is this check does not take into account the units of length. It also does not take into account the character set of the data. For example, 1-byte of the X-DFDL-BITS-MSBF character set has a minLength of 8 characters in the infoset.
There are other things to consider, for example, maybe we have a string with dfdl:length="3" with units of bytes, but we always expect to have 1 character of padding removed, so our maxLength wants to be 2. We would get a warning here too.
Maybe some false positives are okay, but we can probably improve the logic to avoid false positives in some cases at least to take into account units and charsets? Or maybe this warning isn't really that helpful, and the compelxity needed to get it right is not worth it, and should be removed?
Attachments
Issue Links
- is duplicated by
-
DAFFODIL-2678 LengthUnits being applied to minLength/maxLength facets
- Closed