I would certainly call this whole thing variable length because there
are two representations. Length 1, or Length 16.
But really here's a thought about fixed vs. variable length. Or really
a thought about fixed length vs. delimited length.
I think of this data as slash separated first, and then the things
between the slashes must have other characteristics in order to be
valid, such as the proper length.
In your example, suppose the data is "..../20220321T180521/..."
Looks fine. Oh wait, the "Z" for Zulu is missing.
And that's what the diagnostic wants to tell you. It wants to take the
slash separators as highest priority, isolate the string
"20220321T180521" using the following separator, and then tell you
that value isn't valid for your format because the Z is missing.
But if your DFDL models this data as fixed length, then fixed length
16 characters would isolate this string "20220321T180521/" (note the
slash has become part of the value region of the data). Then the
diagnostic is going to be confusing because it will be complaining
about "/" in the value. I would claim that's not a good way to model
what people describe as a "slash separated format".
In summary, you want to avoid lengthKind 'explicit' in such formats
and really use lengthKind 'delimited' wherever possible.
As for exactly how I would suggest to model your data, first here's a
stab at a single element, nillable variation which is pretty clean.
I'm assuming these live within a sequence having separators.
<element name='dt' type="xs:dateTime" nillable='true'
dfdl:nilValue='-'
dfdl:nilValueDelimiterPolicy="none"
dfdl:calendarPattern="YYYYMMdd'T'HHmmss"
dfdl:terminator="Z" />
(This assumes your default format for the schema is dfdl:lengthKind
'delimited', dfdl:calendarPatternKind='explicit',
dfdl:nilKind='literalValue' which would be typical for a format like
this.)
I made the "Z" a terminator since it seems like your dates are always
going to have Z for Zulu (aka UTC) time zone.
If you want your 8 separate elements, then I would model the
"no-value" hyphen as below, where no value is represented in the
infoset by the absence of any date-time element(s).
<choice>
<sequence dfdl:terminator="-"/><!-- no elements at all in this
choice branch -->
<sequence>
<!--
Here you can put your sequence of 8 elements.
My preferred style would still be to use a single element.
-->
<element name="dt" type="xs:dateTime"
dfdl:lengthKind="explicit" dfdl:length='15'
dfdl:lengthUnits='characters'
dfdl:calendarPatternKind='explicit'
dfdl:calendarPattern="YYYYMMdd'T'HHmmss" dfdl:calendarTimeZone='UTC'
dfdl:terminator="Z"/>
</sequence>
</choice>
On Tue, Nov 8, 2022 at 2:22 PM Roger L Costello <[email protected]> wrote:
>
> Hi Folks,
>
> Here is a sample input value:
>
> ../20090214T132530Z/..
>
> It is a single value, consisting of 8 parts (i.e., a composite field):
>
> 2009 is a 4-digit year named DateTimeIso
> 02 is a 2-digit month named MonthNumeric
> 14 is a 2-digit day named Day
> T is the separator between the date and the time, named TimeSeparator
> 13 is a 2-digit hour named HourTime
> 25 is a 2-digit minute named MinuteTime
> 30 is a 2-digit second named SecondTime
> Z is the time zone, named TimeZoneZulu
>
> Here is another value for this field:
>
> ../-/..
>
> If no data is available, then the field is populated with a hyphen.
>
> Is this field fixed or variable length?
>
> /Roger