You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@daffodil.apache.org by "Costello, Roger L." <co...@mitre.org> on 2019/10/03 17:23:53 UTC

What's the difference between a positional sequence and a non-positional sequence?

Hello DFDL community,

Section 14.2 of the DFDL specification distinguishes between positional sequences and non-positional sequences. See excerpt of the specification below. Truthfully, I have no idea what it is saying. Would you provide an example of input data that has a positional sequence, please? And, would you provide an example of input data that has a non-positional sequence, please?  /Roger

[cid:image001.png@01D579ED.CC314A10]

Re: What's the difference between a positional sequence and a non-positional sequence?

Posted by "Beckerle, Mike" <mb...@tresys.com>.
A positional sequence is one where the only way to tell what element a piece of data corresponds to, is by counting the number of elements. Their position provides their identification.

Example:
<sequence dfdl:separator=",">
   <element name="a" type="xs:int" minOccurs="3" maxOccurs="3"/>
   <element name="b" type="xs:int" />
</sequence>

So with data "1,2,3,4" the only way to know that the fourth element is a <b>4</b> is by counting. It's at position 4 so must be element b.

A non-positional sequence you can tell inherently by looking at the data. In real data formats this is generally done with dfdl:initiator.

But you can create an artificial example like this:

<sequence dfdl:separator=",">
     <element name="i" type="xs:int" maxOccurs="unbounded"/>
     <element name="s" type="xs:string" maxOccurs="unbounded"/>
</sequence>

So in this sequence above, so long as the data looks like an integer, you'll use element i. As soon as you find data that doesn't parse as an int, you switch and start parsing element s.

With data "1,2,3,x,y,6" The 6th element is an <s>6</s> but that's not because it is in position 6, it's because a prior element was not parsable as an int.


________________________________
From: Costello, Roger L. <co...@mitre.org>
Sent: Thursday, October 3, 2019 1:23 PM
To: users@daffodil.apache.org <us...@daffodil.apache.org>
Subject: What's the difference between a positional sequence and a non-positional sequence?


Hello DFDL community,



Section 14.2 of the DFDL specification distinguishes between positional sequences and non-positional sequences. See excerpt of the specification below. Truthfully, I have no idea what it is saying. Would you provide an example of input data that has a positional sequence, please? And, would you provide an example of input data that has a non-positional sequence, please?  /Roger



[cid:image001.png@01D579ED.CC314A10]