
Mike - missing brackets - should be "(totaldigits+1)/2" Alan - I see what you have done - you've added textStringPad but also made it the controlling property - ie, you look at textStringPad first. (This matches what IBM WTX does). That's ok - as long as you don't have textStringPad controlling trimming. So here's a proposal that reflects that. Note that I have made textPadKind applicable to strings, numbers and calendars (like textTrimKind) - I think it's the justification direction and the pad char that vary per type, not whether to pad or not. I've also dropped the stuff about a length prefixed string being trimmed to a max length - we can re-instate in the appropriate place if needed - was that to do with ensuring you couldn't pass a string whose length could not be accomodated in the prefix type (because that's not how it was worded). Property Name Description textTrimKind Enum Valid values ?none?, ?padChar? Indicates whether to trim data on input. 'none': No trimming takes place 'padChar': If lengthKind results in a fixed length then the padding character can be trimmed instead, as controlled by textStringJustification. Annotation: dfdl:element (simple type ?string?) textPadKind Enum Valid values ?none?, ?fixed?, ?minimum' Indicates whether to pad data on output. ?none?: The string is expected to match the length, it is an error otherwise. 'fixed': If lengthKind results in a fixed length then the data can be padded to the fixed length, as controlled by textStringJustification. 'minimum': If lengthKind results in a fixed length then the data can be padded to the length given by dfdl:outputMinLength property, as controlled by textStringJustification. Property Name Description textStringJustification Enum Valid values ?left?, ?right?, ?center? Output: 'left': Justifies to the left and adds padding chars to the string contents if the string is too short, to the length determined by the textPadKind property. 'right': Justifies to the right and adds padding chars to the string contents if the string is too short, to the length determined by the textPadKind property. ?center?: Adds equal padding chars left and right of the string contents if the string is too short, to the length determined by the textPadKind property. It adds one extra padding char before if needed. Input: 'left': Trims any padding characters from the right of the string, according to textTrimKind property. 'right': Trims any padding characters from the left of the string, according to textTrimKind property. ?center? Trims any padding characters from the left and right of the string, according to textTrimKind property. [OMG/CAM property justification] Annotation: dfdl:element (simple type ?string?) Regards Steve Hanson Programming Model Architect WebSphere Message Brokers Hursley, UK Internet: smh@uk.ibm.com Phone (+44)/(0) 1962-815848 DFDL <mbeckerle.dfdl@gmail.com> Sent by: dfdl-wg-bounces@ogf.org 09/12/2008 19:24 To Alan Powell/UK/IBM@IBMGB cc "dfdl-wg@ogf.org" <dfdl-wg@ogf.org> Subject Re: [DFDL-WG] Padding to Minimum length proposal and Implicit lengths In the table I didn't understand the "totaldigits+1/2" ...mikeb On Dec 9, 2008, at 1:33 PM, Alan Powell <alan_powell@uk.ibm.com> wrote: 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@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 -- dfdl-wg mailing list dfdl-wg@ogf.org http://www.ogf.org/mailman/listinfo/dfdl-wg-- dfdl-wg mailing list dfdl-wg@ogf.org http://www.ogf.org/mailman/listinfo/dfdl-wg 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