You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

The issues identified in Analysis: Schema Compiler Backpointers/Copying require some design and test planning.

IsHidden

Implementation

This flag member is set on infoset elements at the time they are created (parsing) or spliced into the infoset (unparsing - streaming unparser).

This works by dynamically maintaining boolean state member isInsideHiddenContext.

  1. ParseOrUnparseState has member.

    var isInsideHiddenContext : Boolean = false
  2. SequenceRuntimeData has constructor argument/member:

    val maybeHiddenGroupRefArg : Maybe[ModelGroupRuntimeData] 
    lazy val maybeHiddenGroupRef = maybeHiddenGroupRefArg // and also serialized

    with value Nope for anything except a SequenceGroupRef that has the dfdl:hiddenGroupRef property. This is a Maybe type to provide for access to the referenced group's model-group runtime data. However, for purposes of isHidden computation this is just used as a boolean flag.

  3. In the parse1 and unparse1 methods of Parser and Unparser, If
    1. the TRD of the current processor is of type SequenceRuntimeData, and
    2. trd.maybeHiddenGroupRef.isDefined, and
    3. the state.isInsideHiddenContext is currently false
    4. then invoke the parse/unparse method within a code branch that first sets the isInsideHiddenContext to true, and sets it back to false upon unwinding. Note that a try-finally type of unwind-protect could be used, but should not be necessary, as parsers are supposed to unwind the stack without throws, and all throws are fatal when unparsing.
    5. else invoke the parse/unparse method normally, which does not affect the state of isInsideHiddenContext, so if already true, it stays true, if currently false, stays false.
  4. When infoset elements are created by element combinators, (parsing), or when they are accepted and spliced into the infoset by element combinators (unparsing) they are setIsHidden(state.isInsideHiddenContext)

Test Plan/Design-for-Test

Existing tests that expect to determine isHidden from ERDs of elements should be removed/rewritten, as the information is no longer available there.

Tests should insure that elements are properly hidden if they are multiple group references away from a true dfdl:hiddenGroupRef.



  • No labels