<br><font size=2 face="sans-serif">For the broader DFDL workgroup (Martin,
Simon, and any other onlookers), this proposal was circulated among the
IBM DFDLers and we liked it, so we wanted others to take a look.</font>
<br>
<br><font size=2 face="sans-serif">------------------------------------------------------------------------</font>
<br>
<br><font size=2 face="sans-serif">Prefix lengths are common, but unfortunately
there are many prefix length formats. </font>
<br>
<br><font size=2 face="sans-serif">For flexibility we want to be able to
use a hidden field and calc properties, but this is clumsy enough to be
very unattractive except for extreme cases. However, without it we have
the keyword proliferation issue.</font>
<br>
<br><font size=2 face="sans-serif">Here's a way to get the best of both
worlds.</font>
<br>
<br><font size=2 face="sans-serif"><element name="myString"
type="string" </font>
<br><font size=2 face="sans-serif">
dfdl:lengthKind="prefixed" dfdl:lengthPrefixType="packed4"/></font>
<br>
<br><font size=2 face="sans-serif">here's the trick. Named types for length
prefixes are just a real schema type definition of an integer type with
dfdl annotations. .</font>
<br>
<br><font size=2 face="sans-serif"> <simpleType name="packed4"></font>
<br><font size=2 face="sans-serif"> <restriction
base="integer" dfdl:representation="decimal" dfdl:decimalType="packed"
</font>
<br><font size=2 face="sans-serif">
dfdl:numberFormat="9999" dfdl:decimalSigned="false"
</font>
<br><font size=2 face="sans-serif">
dfdl:prefixIncludesPrefixLength="false"/></font>
<br><font size=2 face="sans-serif"> </simpleType></font>
<br>
<br><font size=2 face="sans-serif">The behavior is simple. Imagine that
a hidden length prefix element is defined immediately before your element,
and it's type is the one given here.</font>
<br><font size=2 face="sans-serif">You don't have to model that hidden
element. DFDL knows how to do that for you. Just tell us it's type, including
DFDL properties for the representation </font>
<br><font size=2 face="sans-serif">of that type.</font>
<br>
<br><font size=2 face="sans-serif">We could build in a few of these to
some predefined profiles. E.g., dfdl:prefix2, and dfdl:prefix4 might be
the typical 2 and 4 byte length prefix definitions you see</font>
<br><font size=2 face="sans-serif">in PL1 for example. </font>
<br>
<br><font size=2 face="sans-serif">I suggest the above because of the slippery
slope where we have to gradually bifurcate all the integer properties to
have lengthPrefix flavors of them</font>
<br><font size=2 face="sans-serif">e.g.,</font>
<br>
<br><font size=2 face="sans-serif">lengthPrefixRepresentation = text or
binary or decimal</font>
<br><font size=2 face="sans-serif">lengthPrefixLengthUnits = bits, bytes,
or characters</font>
<br><font size=2 face="sans-serif">lengthPrefixLength = an integer</font>
<br><font size=2 face="sans-serif">lengthPrefixLengthIncludesPrefix (boolean)</font>
<br><font size=2 face="sans-serif">lengthPrefixTextNumberJustification</font>
<br><font size=2 face="sans-serif">lengthPrefixTextNumberFormat</font>
<br>
<br><font size=2 face="sans-serif">Anywhere you stop here there will be
many cases that aren't covered.</font>
<br>