Hi Mike, I gave your suggested approach a try. It failed.
With this input: …/AB /… it works. With this input: …/ - /… it fails, producing this error: [error] Validation Error: Foo failed facet checks due to: facet enumeration(s): AB|ABC Further, even if the approach were to work with this example where the field length is 3, it would be an untenable approach for longer fixed fields. For example, if the field length was 10, then the nilValue would need something like 10-factorial whitespace-separated values. Do you have another suggested approach? /Roger From: Mike Beckerle <[email protected]> Sent: Monday, August 8, 2022 9:38 AM To: [email protected] Subject: [EXT] Re: Conflicting requirements: fixed length field, nillable, some enumeration values shorter than the required length I would try making the nilValue "%SP;-%SP; -". That is two separate possibilities for nilValue, one is space-hyphen-space, the other just hyphen. (It's a whitespace-separated list of nil values tokens.) The first one will be used for unparsing. Both will be tried for parsing. That along with justification left might work. On Mon, Aug 8, 2022 at 8:01 AM Roger L Costello <[email protected]<mailto:[email protected]>> wrote: Hi Folks, I have an input field that is fixed length (3). If there is no data, the field is to be populated with a hyphen (of course, it must be padded with spaces to the required length). The schema has a simpleType with enumeration facets. Some enumeration values are less than the required length. Here's how I specify the field: <xs:element name="Foo" nillable="true" dfdl:nilKind="literalValue" dfdl:nilValue="-" dfdl:lengthKind="explicit" dfdl:length="3" dfdl:textTrimKind="padChar" dfdl:textPadKind="padChar" dfdl:textStringPadCharacter="%SP;" dfdl:textStringJustification="center"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="AB"/> <xs:enumeration value="ABC"/> </xs:restriction> </xs:simpleType> </xs:element> Notice dfdl:textStringJustification="center" which is fine for the nillable value (hyphen) but not for a regular value such as AB which should be left justified. As the schema is, the input could contain this (assume slash separators): .../ AB/... which is incorrect. So, there are conflicting requirements: the nillable value needs dfdl:textStringJustification="center" whereas the normal values need dfdl:textStringJustification="left". What to do about this? /Roger
