This is a static archive of the previous Open Grid Forum Redmine content management system saved from host redmine.ogf.org file /boards/15/topics/63?r=142 at Thu, 03 Nov 2022 23:16:25 GMT dfdl:valueLength function - unclear what it does. - Public Comments Archive - Open Grid Forum

dfdl:valueLength function - unclear what it does.

Added by Michael Beckerle about 9 years ago

Spec says:
dfdl:valueLength(path, lengthUnits) - returns the value length which excludes any padding or filling which might be added for a specified length

Is this well defined even?

It seems an abstract value other than a string doesn’t have an inherent length. E.g., the number 1000 is an abstract concept. It its content takes up a minimum of 4 characters base 10, but 3 in base 16. Depending on textNumberPattern, it may need a grouping separator, which increases the size of the content region in our grammar. So that's not the 'value' it's the content region within the overall representation of the element.

Do we really want functions named paddedContentLength and unpaddedContentLength ?


Replies (3)

RE: dfdl:valueLength function - unclear what it does. - Added by Steve Hanson about 9 years ago

The two functions are called valueLength and contentLength so they relate directly to the grammar regions. They were originally called unpaddedLength and representationLength, and this was changed by errata 3.18 which enforced the correct use of 'value', 'content' and 'representation' throughout the spec.

For valueLength you take the infoset value given by the XPath argument and you unparse it according to the properties in force for the element that describes it, but you don't pad or fill.

What I think is missing is a statement that you can't specify $lengthUnits 'characters' for a simple element unless the element has text representation.

Action 242 - RE: dfdl:valueLength function - unclear what it does. - Added by Michael Beckerle almost 9 years ago

Add missing NilLiteralValue from list of value regions in discussion.

Clarify "For simple types, the valueLength() function returns a length which excludes any padding or filling." By changing it to mention the length of value regions of the grammar.

Fix typos "is is" in last paragraph about valueLength(). Bold font "or" first paragraph.

Add that specifying "characters" for length units, the property dfdl:encoding must be defined for the node.

Taking valueLength of a complex typed element requires that the entire complex typed element is textual in a single encoding given by dfdl:encoding property and it is a SDE otherwise.

Notes below the table of functions need to be improved/corrected. These should not just be "notes" but should be one or more subsections about specific functions or groups of functions.

(1-3/3)

This is a static archive of the previous Open Grid Forum Redmine content management system saved from host redmine.ogf.org file /boards/15/topics/63?r=142 at Thu, 03 Nov 2022 23:16:25 GMT