[DFDL-WG] outputValueCalc to compute array elements - not possible?

Mike Beckerle mbeckerle.dfdl at gmail.com
Tue Jun 4 16:44:05 EDT 2013


I want to create an array of short strings from a single long string using
outputValueCalc.

Let's call the initial single long string s.

I want the max length of each short string to be m.

So ceiling(s/m) is the number of array elements.

Given m, it should be clear that each array element's contents can be
computed as a specific sub-string of s, determined using m, and the index
of the array element within the array, i.e., the position() function in
XPath. The substring starts at m*(position() - 1), the end is length(s) -
m*(position() -1) if position is ceiling(s/m), and start + m otherwise.

However, current rules in the spec say that elements must exist in the
infoset to be unparsed unless they are filled in by way of defaulting up to
minOccurs.

In my scenario I don't want to default them, I want to compute their
values, but I do want to start with an infoset which has zero of the array
elements pre-existing. I'm pretty sure there is no way for DFDL to will n
array-elements into existence in the augmented infoset just knowing n, such
that they then can each compute their sub-element's values using
outputValueCalc.

Also I think we currently don't allow outputValueCalc on an array element
anyway. But my array element could be a complex type containing an element
with an outputValueCalc.

So I think there is no way to achieve what I want, eventhough there's no
issue with figuring out how many array elements there should be nor any
issue with figuring out the contents of each array element.

I raise this by way of wanting to be able to unparse somehow, anything I
can parse. I can parse a variable-length array of strings, and compute a
string which is their concatenation. It's tricky but doable. I cannot break
up a long string into pieces which are in an array.

-- 
Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology |
www.tresys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20130604/d798246d/attachment.html>


More information about the dfdl-wg mailing list