Posted: Fri Feb 16, 2018 6:23 am Post subject: DFDL and backtracking - X12 data
Voyager
Joined: 28 Nov 2004 Posts: 76
Hi
Can anyone point to an example of correct usage of DFDL annotation initiatedContent=yes and discriminators.
We are parsing X12 data (tag delimited EDI). Segments are identified with initiatedContent=yes - when a failure occurs the parser backtracks looking for alternate paths - this ultimately reports failure which is misleading.
Also tried adding discriminators (which evaluate to true) here too, the parser backtracks and results in misleading failure location.
Thoughts/comments/examples would be much appreciated.
initiatedContent='yes' is designed to simplify the modelling of a choice that contains tagged fields/structures. Normally, if the tag has matched then you don't want to backtrack past that point in the data - you want the choice to be resolved (discriminated) by the tag.
If you are unfortunate enough to have a choice of tagged structures and there are different structures that can have the same tag...then you don't want to use intiatedContent='yes' (because backtracking is the only way to successfully parse that type of structure).
Quote:
Segments are identified with initiatedContent=yes - when a failure occurs the parser backtracks looking for alternate paths - this ultimately reports failure which is misleading.
The initiatedContent='yes' is a property of the choice group - not a property of the members of the choice group. It (implicitly) asserts that the content of the choice group is tagged with unique tags, and none of the tags is a prefix of any other tag.
Were using intiatedContent on sequences as each have unique initiators that identify that they exist.
Using this annotation is not helping with backtracking but its not causing any schema error either. So can it be used in this context too or only applicable in choice groups?
It's fine to use initiatedContent on a sequence - the DFDL specification explicitly says so. But...
Quote:
Were using intiatedContent on sequences as each have unique initiators that identify that they exist.
I think this may be where you're going wrong. You need to put the initiatedContent property on the parent sequence. Not on the sequence groups that represent the X12 segments. See my comment above re: choice groups and what the initiatedContent property is asserting.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum