[DFDL-WG] Unparsing and outputValueCalc

Mike Beckerle mbeckerle.dfdl at gmail.com
Wed Jun 11 23:00:39 CDT 2008


 

Based on our discussions on the call today, I was thinking about the
definition of output "unparsing" and how outputValueCalc is dealt with. 

 

I believe the following language is sufficient to explain how such
expressions are evaluated.

 

When unparsing, an element declaration in the schema must have a
corresponding value in the infoset. 

If one exists then that value is serialized based on its properties. If
there is no corresponding value in the infoset then a value is computed as
follows:  

a)     If the element declaration is required, and has a default value
specified, then an element item having the default value is created in the
infoset

b)     If the element declaration has an outputValueCalc property then the
expression which is the property value is evaluated and the resulting value
becomes the value of the element item in the infoset. References to other
infoset elements from within the outputValueCalc expression must obtain
their values from the infoset directly (when the value is already present)
or by recursively using these methods (a) and (b) as needed. 

c)     If any infoset element's value is requested and neither (a) nor (b)
applies, then it is a processing error.

 

Seems ok to me. This is the ordinary stuff of language specification.

 

The function dfdl:length() needs some additional discussion. 

 

I think we can restrict dfdl:length() to accept only paths to element info
items. I.e., the first argument must be an explicit path. 

 

(Alternatively, we can make the dfdl:length() be a member of an info item,
as in ../x.dfdl:length('bytes')  - of however we want to notate obtaining
the length from a path, instead of dfdl:length(../x, 'bytes'). Either
notation style is ok with me.)

 

The path for the dfdl:length must be to an element which has representation.
That is, it cannot have the inputValueCalc property.  This insures that it
is meaningful to ask for the dfdl:length, that is the representation length
of the item measured in the requested units.

 

There is already an Xpath function count() which returns the number of
occurrences of an item.  Both count() and dfdl:length() potentially imply
buffering in the unparser implementation. 

 

Comments?

 

Mike Beckerle | OGF DFDL WG Co-Chair | CTO | Oco, Inc.
Tel:  781-810-2100  | 504 Totten Pond Road, Waltham MA 02451 |
<mailto:mbeckerle.dfdl at gmail.com> mbeckerle.dfdl at gmail.com 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.ogf.org/pipermail/dfdl-wg/attachments/20080612/57829f6b/attachment.html 


More information about the dfdl-wg mailing list