DFDL language: points of uncertainty

How DFDL parsers resolve choices, optional elements, and variable arrays.

A DFDL parser is a recursive-descent parser that uses lookahead to resolve points of uncertainty:
  • A choice
  • An optional element
  • A variable array of elements
The parser must speculatively try to parse data until an object is either 'known to exist' or 'known not to exist'. Until the condition has been established, a processing error causes the parser to suppress the error, backtrack, and try an alternative. To prevent incorrect backtracking, use the dfdl:discriminator annotation to assert that an object is 'known to exist'. Initiators are also able to assert that an object is 'known to exist'. If all alternatives have an initiator, set property dfdl:initiatedContent to 'yes' on the parent sequence or choice, in preference to using dfdl:discriminator annotations.