Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New delimited lengthKind behavior for delimited by following dfdl:initiator #47

Open
mbeckerle opened this issue Jun 14, 2023 · 1 comment
Labels
DFDL 2.0 For issues associated with DFDL v2.0 (next major revision) enhancement New feature or request

Comments

@mbeckerle
Copy link
Collaborator

mbeckerle commented Jun 14, 2023

We've seen this so many times now that it really must be considered for DFDL v2.0 as a new feature.

<sequence dfdl:separator="%SP; %NL;">  
  ....
  <element dfdl:initiator="A)%WSP+; A)" name="location" type="notam:nzString" dfdl:lengthKind="pattern"
                   dfdl:lengthPattern="[A-Z0-9 ]{1,69}(?=[ \r\n]{1,5}B\))"/>
  <element dfdl:initiator="B)%WSP+; B)" name="startOfActivity" type="notam:effectiveDateTime"/>
  ....
</sequence>

In the above, the location element can contain the separator + a prefix of the initiator, " B", of the next element startOfActivity. It just can't contain the whole separator+initiator " B)". The use of lengthKind 'pattern' here, and a custom nzString (not zero length string) type, is the hack to express that the location element is delimited by finding what must be the starting initiator of the next element (after the separator).

This works in simple cases like this, because the next thing is easy to discern. But this gets harder if instead of the startOfActivity element, we had a choice, with many children elements having initiators. The regex for the pattern becomes hard to maintain and highly complex, hard to test, etc.

So the request here is for a way to specify that the element is delimited, but that the terminator is finding (but not consuming) the initiator of something following (presumably or end-of-data).

@mbeckerle mbeckerle added enhancement New feature or request DFDL 2.0 For issues associated with DFDL v2.0 (next major revision) labels Jun 14, 2023
@mbeckerle
Copy link
Collaborator Author

The required behavior is not quite just delimited by next initiator. The elements may appear in a sequence having a separator, and in that case, the first element may allow content that matches the separator plus a prefix of the next thing's initiator.

I updated the description above to clarify this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DFDL 2.0 For issues associated with DFDL v2.0 (next major revision) enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant