Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-785

Assert execution timing for sequence is incorrect.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: s10
    • Fix Version/s: 2.2.0
    • Component/s: Back End, General
    • Labels:
      None

      Description

      If you have a sequence (presumably same bug will occur for choice), and it begins with an annotation containing a dfdl:assert with testKind expression, then that is supposed to execute after the sequence children have been evaluated. This is consistent with elements and element refs, where an assert/discriminator with testKind=expression executes AFTER the element itself has been parsed.

      This is confusing for sequences and choices because the assert will appear lexically before the rest of the sequence/choice children, but it executes after. (Perhaps we should issue a warning because the workaround - described below - is actually a better & clearer way to write a schema.)

      (When testKind=pattern, they execute before)

      Same goes for discriminators.

      (Errata 3.25: Section 9. Evaluation Order for Statement Annotations)

      Currently seems to execute before.

      This is low priority because the workaround is easy. Just put the assert inside it's own sequence, and then insert that sequence below all the other things in the enclosing sequence.

      You have to do this:

      <sequence>
      ... where the assert was...
      <element .../>
      <element.../>
      <sequence>
      ... new location for assert ...
      </sequence>
      </sequence>

      So the annotation moves below, but is still first in the sequence that directly contains it, but that sequence is otherwise empty.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mbeckerle Michael Beckerle
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: