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 <coste...@mitre.org> 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 >