[
https://issues.apache.org/jira/browse/DAFFODIL-2826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17732754#comment-17732754
]
Mike Beckerle commented on DAFFODIL-2826:
-----------------------------------------
Workaround for this is to add an assert at the end of the horizontalVisiblity
element evaluated after the contents have been parsed.
It should be true only if one of the children elements exists. This causes
horizontalVisibility to fail rather than be empty, and so the minOccurs="0"
means it's optional, so nothing is added to the infoset.
> emptyElementParsePolicy 'treatAsAbsent' not working properly
> ------------------------------------------------------------
>
> Key: DAFFODIL-2826
> URL: https://issues.apache.org/jira/browse/DAFFODIL-2826
> Project: Daffodil
> Issue Type: Bug
> Components: Back End
> Affects Versions: 3.5.0
> Reporter: Mike Beckerle
> Priority: Major
>
> In either 3.4.0 or 3.5.0-SNAPSHOT the property
> dfdlx:emptyElementParsePolicy='treatAsAbsent' does not seem to be working at
> least for empty elements of complex type.
>
> {code:java}
> <element name="horizontalVisibility" minOccurs="0"
> dfdlx:emptyElementParsePolicy="treatAsAbsent">
> <complexType>
> <sequence>
> <element name="visibility" type="w:visibilityType" minOccurs="0"/>
> <element name="directionalVariationInVisibility" minOccurs="0">
> <complexType>
> <choice>
> <element name="noDirectionalVariation"
> dfdl:initiator="%WSP+;NDV NDV" type="w:zlString"/>
> <sequence dfdl:initiator="%WSP+; %ES;">
> <element name="minimumVisibility" type="w:uint4"/>
> <element name="direction" type="w:directionEnum"/>
> </sequence>
> </choice>
> </complexType>
> </element>
> </sequence>
> </complexType>
> </element>
>
> {code}
> The enclosing parent element horizontalVisibility is optional. If all content
> within it is not present, the property
> dfdlx:emptyElementParsePolicy="treatAsAbsent" means that this empty complex
> type element should NOT be added to the infoset.
> Daffodil does have tests for emptyElementParsePolicy, but perhaps the
> complex-type element case is not included?
> See also DAFFODIL-2824.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)