What you seek is to specify the positions of the fields, not their lengths.

Some formats are specified that way, but it's really problematic. E.g., is the 
length always the distance to the start of the subsequent field? Or can storage 
be aliased/overlapping? Do the elements need to be specified in order of 
starting offset, or does DFDL have to sort them itself? Does the starting 
position have to be a fixed offset or can it be computed based on a stored 
value? What is this an offset from? Where's the anchor point the offset is 
added to? Is that an offset from the start of that thing, or the end of that 
thing? By start of that thing is that at the start of the framing or the start 
of the content or...??

It's not impossible. There could be properties for resolving all these 
questions. Maybe there will be some day. These features really are needed to 
express some formats (like TIFF images), though that probably requires more 
than just this.

The DFDL workgroup punted all this for DFDL v1.0 and went with lengths, not 
positions. This was based on the precedent of tools in the marketplace, *all* 
of which specify lengths (there might be one example (back then) of a tool that 
*also* allowed specifying positions instead of lengths, but I can't recall 
actually.)

Alignment really is entirely about binary data, and data structures the layout 
of which (by compilers) incorporates things about byte boundaries, word sizes, 
etc.


________________________________
From: Roger L Costello <coste...@mitre.org>
Sent: Tuesday, December 15, 2020 10:32 AM
To: users@daffodil.apache.org <users@daffodil.apache.org>
Subject: Can the alignment property be used in a text format to specify columns?

Hi Folks,

Suppose that a data format about fruits has data like this:

orange           orange           tree
banana           yellow           tree
raspberry        red              bush

There are 3 columns. The data for the first column starts in column 1. The data 
for the second column starts in column 30. The data for the third column starts 
in column 60.

Can this data format be specified using the alignment property?

I've always thought that the alignment property was exclusively for binary data 
formats, but if it can be used to describe columnar text data formats, that 
would be pretty cool.

/Roger

Reply via email to