[ 
https://issues.apache.org/jira/browse/DAFFODIL-2306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17067074#comment-17067074
 ] 

Mike Beckerle commented on DAFFODIL-2306:
-----------------------------------------

I do have a clean workaround for this that I actually even like better.
{code:java}
<xs:group name="wordPadding">
  <xs:sequence >
    <xs:element name="spare" type="vmfgi:padding"
       dfdl:length="{ $tns:l16WordPaddingBits }"
       dfdl:occursCountKind="expression" minOccurs="0"
       dfdl:occursCount="{ if ($tns:l16WordPaddingBits eq 0) then 0 else 1 }"/>
  </xs:sequence>
</xs:group>
{code}
 

> Abort: NadaParsers are all supposed to optimize out!
> ----------------------------------------------------
>
>                 Key: DAFFODIL-2306
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2306
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Middle &quot;End&quot;
>    Affects Versions: 2.5.0
>            Reporter: Mike Beckerle
>            Priority: Major
>             Fix For: 2.6.0
>
>
> I have a schema that uses this group. It's a way of doing an optional element
> using a choice-by-dispatch.
> Running this causes an abort when a NadaParser survives the optimizer and 
> makes it into the parser definition.
> {code:java}
> <xs:group name="wordPadding">
>   <xs:choice dfdl:choiceDispatchKey="{ if ($tns:l16WordPaddingBits eq 0) then 
> '0' else '1' }" >
>      <xs:sequence dfdl:choiceBranchKey="0"/>
>       <xs:element dfdl:choiceBranchKey="1" name="spare" type="vmfgi:padding" 
> dfdl:length="{ $tns:l16WordPaddingBits }" />
>   </xs:choice>
> </xs:group>{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to