[DFDL-WG] Padding to Minimum length proposal and Implicit lengths

Alan Powell alan_powell at uk.ibm.com
Tue Dec 9 12:33:05 CST 2008


Mike, Steve

The proposal to allow padding to minimum length on output consists of

new property ouputMinLength
Separate pad properties for string, number and calendar types
new textxxxxPad property to control padding . Moved from from 
textxxxxxxJustification

1       Padding

Property Name
Description
outputMinLength
String. 
Only used when textStringPad, textNumberPad or textCalendarPad is 
?minlength?. 
Specifies the minimum output length of this element using either a fixed 
number or an expression to refer to an element earlier in the data,.
Annotation: dfdl:element (all simple types)

1.1     Properties Specific to Strings with Text representation


Property Name
Description
textStringPad
Enum
Valid values  ?none?,  ?fixed?, ?minLength?
Controls how an item is justified on output when the actual length of a 
text string is different from the specified length.
Controls how an item is trimmed on input if  textTrimKind is padChar
If ?none? the string is expected to match the length.
Otherwise:
- If lengthKind results in a fixed length: If shorter than the specified 
length it is padded with the pad character. If longer than the specified 
length it is truncated. 
- If lengthKind is ?prefixed?: If the string is longer than any specified 
maximum length it is truncated.
textStringJustification
Enum
Valid values ?left?, ?right?,  ?center?
 ?center? adds equal padChars before and after the string contents if the 
string is too short. It adds one extra padChar before if needed.
?center? truncates equal numbers of characters before and after if the 
string is too long. It removes one extra character at the front of the 
string if needed.
 [OMG/CAM property justification]
Annotation: dfdl:element (simple type ?string?)
textStringPadCharacter
String.
The padding character used as the default for justification of text 
elements.
In fixed width character sets this must contain a full single character 
representation. So if hex entities are used, enough hex bytes must be 
supplied to provided the full width of a character.
In variable width character sets, this character must be a minimum-width 
character unless it is specified as an entity (see section TBD Entities)
Annotation: dfdl:element (simple type ?string?)

1.2     Properties Specific to Number with Text representation

Property Name
Description
textNumberPad
Enum
Valid values  ?none?,  ?fixed?, ?minLength?
Controls how an item is justified on output when the actual length of a 
text string is different from the specified length.
Controls how an item is trimmed on input if  textTrimKind is padChar
If ?none? the string is expected to match the length.
Otherwise:
- If lengthKind results in a fixed length: If shorter than the specified 
length it is padded with the pad character. If longer than the specified 
length it is truncated. 
- If lengthKind is ?prefixed?: If the string is longer than any specified 
maximum length it is truncated.
textNumberJustification
Enum
Valid values ?left?, ?right?,  ?center?
 ?center? adds equal padChars before and after the string contents if the 
string is too short. It adds one extra padChar before if needed.
?center? truncates equal numbers of characters before and after if the 
string is too long. It removes one extra character at the front of the 
string if needed.
 [OMG/CAM property justification]
Annotation: dfdl:element (simple type ?string?)
textNumberPadCharacter
String.
The padding character used as the default for justification of text 
elements.
In fixed width character sets this must contain a full single character 
representation. So if hex entities are used, enough hex bytes must be 
supplied to provided the full width of a character.
In variable width character sets, this character must be a minimum-width 
character unless it is specified as an entity (see section TBD Entities)
Annotation: dfdl:element (simple type ?string?)

1.3     Properties Specific to Calendar  with Text representation

Property Name
Description
textCalendarPad
Enum
Valid values  ?none?,  ?fixed?, ?minLength?
Controls how an item is justified on output when the actual length of a 
text string is different from the specified length.
Controls how an item is trimmed on input if  textTrimKind is padChar
If ?none? the string is expected to match the length.
Otherwise:
- If lengthKind results in a fixed length: If shorter than the specified 
length it is padded with the pad character. If longer than the specified 
length it is truncated. 
- If lengthKind is ?prefixed?: If the string is longer than any specified 
maximum length it is truncated.
textCalendarJustification
Enum
Valid values ?left?, ?right?,  ?center?
 ?center? adds equal padChars before and after the string contents if the 
string is too short. It adds one extra padChar before if needed.
?center? truncates equal numbers of characters before and after if the 
string is too long. It removes one extra character at the front of the 
string if needed.
 [OMG/CAM property justification]
Annotation: dfdl:element (simple type ?string?)
textCalendarPadCharacter
String.
The padding character used as the default for justification of text 
elements.
In fixed width character sets this must contain a full single character 
representation. So if hex entities are used, enough hex bytes must be 
supplied to provided the full width of a character.
In variable width character sets, this character must be a minimum-width 
character unless it is specified as an entity (see section TBD Entities)
Annotation: dfdl:element (simple type ?string?)


I also completed the table of meaning of implicit lengths for different 
types

1.1     Lengths of simple types for lengthKind=implicit


Implemented in WMB GUI helper function


Simple type
text (+ xml)
binary

String
Length/maxlength
n/a

Float
Text: numberPattern
(length of positive subpattern)
Zoned: TotalDigits
32

Double
Text: numberPattern
Zoned: TotalDigits
64

Decimal/Integer
Text: numberPattern
Zoned: TotalDigits 
Pkd/bcd: TotalDigits+1/2

Long, UnsignedLong
Text: numberPattern
Zoned: 19
binary: 64
Pkd/bcd: TotalDigits+1/2

Int, Unsignedint
Text: numberPattern
Zoned: 10
binary: 32
Pkd/bcd: TotalDigits+1/2

Short, Unsignedshort
Text: numberPattern
Zoned: 5
binary: 16
Pkd/bcd: TotalDigits+1/2

Byte, Unsignedbyte
Text: numberPattern
Zoned: 3
binary: 8
Pkd/bcd: TotalDigits+1/2

DateTime
Calendarpattern


Date
Calendarpattern


Time
Calendarpattern


Duration
Calendarpattern


Boolean
Length of  textBooleanTrue
32

HexBinary
n/a
Length/maxlength
















Alan Powell

 MP 211, IBM UK Labs, Hursley,  Winchester, SO21 2JN, England
 Notes Id: Alan Powell/UK/IBM     email: alan_powell at uk.ibm.com 
 Tel: +44 (0)1962 815073                  Fax: +44 (0)1962 816898






Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU











Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.ogf.org/pipermail/dfdl-wg/attachments/20081209/9d844856/attachment.html 


More information about the dfdl-wg mailing list