I think this may work: a rich nilValue property that takes advantage of
%WSP*; character class entity.

<element name="Foo" nillable='true'
  dfdl:nilValue="%WSP*;-%WSP*;"
  dfdl:nilKind="literalValue"
  dfdl:lengthKind="explicit"
  dfdl:length="100"
  dfdl:textPadKind='padChar'
  dfdl:textStringPadCharacter='%SP;'
  dfdl:textStringJustification="left"
  >
    <simpleType>
    .... If this is a string type, I think you could also have
    a pattern facet here for when the value is *not* nilled ....
    </simpleType>
</element>

Unfortunately, %WSP*; absorbs any white space including line endings, and
fixed length data shuts off delimiter scanning. So bad data could be parsed
which has say, 99 linefeed characters then a hyphen. That would match the
nilValue above.

We don't have a way of saying only "within a line white spaces" in DFDL as
yet. However, since the length here is limited to 100, this is not going to
go wild and consume data after that 100 characters while searching for yet
more whitespace.

Proposed DFDL character class entity %LSP*; would be any number of spaces
or tabs only, no line endings would match. %SP*; would be zero or more
spaces only. (%LSP+; would be 1 or more tabs/spaces, %SP+; would be one or
more spaces.)


On Thu, Jul 28, 2022 at 12:20 PM Roger L Costello <[email protected]>
wrote:

> Hi Folks,
>
> I have a text data format that has a field of fixed length. Let's say the
> field's name is Foo and it's width is 100 characters.
>
> If there is no data to populate the field, a single hyphen is to be
> inserted in the field, with surrounding spaces.
>
> How do I specify the field's nilValue? There are 100 possible values: "-
> 99 spaces" or "space - 98 spaces" or "space space - 97 spaces" or ...
>
> Do I have to list all 100 possible nil values?
>
> /Roger
>

Reply via email to