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

Michael Beckerle commented on DAFFODIL-1976:
--------------------------------------------

Actually, the above comment:
{quote}Specifically, an empty <y/> element appears in the infoset from the 
first parse pass, and that element should NOT be present, as the element is 
optional, the content is zero-length, and the type is xs:string. This <y/> 
element should only be created if there is some empty value syntax defined by 
way of initiator/terminator/emptyValueDelimiterPolicy.
{quote}
This is not correct. If the legal syntax of the string-type element allows for 
an empty string to be created without any initiator/termiantor, and if a 
separator is present, then an empty string element should be created.

One uses emptyValueDelimiterPolicy to insist that syntax e.g., () or '' be 
present in order for an empty string to be expressed. That way if you just have 
adjacent separators you WONT get an optional string element.

The same applies to nilled values if the dfdl:nilValue="%ES;". In that case, 
even if the element is optional, if the separator is found, then a nilled 
element will be created. You use nilValueDelimiterPolicy to insist on some 
syntax for optional nil values.

Note: IBM DFDL (as of 2019-05-01) doesn't implement this same behavior. They 
never create elements for empty strings. I.e., are not consistent with the 
above behavior. Daffodil may need a flag to provide compatiblity with this 
behavior in order to run some of the published DFDL schemas on DFDLSchemas 
github.

 

> Incorrect creation of empty-string element
> ------------------------------------------
>
>                 Key: DAFFODIL-1976
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-1976
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Back End, Compatibility
>    Affects Versions: 2.1.0
>            Reporter: Michael Beckerle
>            Assignee: Michael Beckerle
>            Priority: Major
>              Labels: ForInteroperabilityTest
>             Fix For: 2.4.0
>
>
> Test "scenario1_7" was made "threePass" to get it to pass, but really it 
> should be onePass, and the underlying Daffodil behavior needs to change.
> Specifically, an empty <y/> element appears in the infoset from the first 
> parse pass, and that element should NOT be present, as the element is 
> optional, the content is zero-length, and the type is xs:string.  This <y/> 
> element should only be created if there is some empty value syntax defined by 
> way of initiator/terminator/emptyValueDelimiterPolicy. 
> See the shouldRemoveZLStringHexBinaryValue method, which the code has wired 
> to 'false' currently. Note that the parse must be attempted so that 
> asserts/discriminators and setVars are executed. 
> Furthermore, note that this does NOT terminate the array, as it is not a 
> processing error. 
> This test, and other tests that construct these empty 'y' elements should be 
> corrected, and should not require threePass treatment from the TDML runner. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to