You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "Mike Beckerle (Jira)" <ji...@apache.org> on 2020/07/30 20:18:00 UTC

[jira] [Resolved] (DAFFODIL-2285) Impossible to have nilled padded string when padChar == nilValue

     [ https://issues.apache.org/jira/browse/DAFFODIL-2285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Beckerle resolved DAFFODIL-2285.
-------------------------------------
    Resolution: Not A Problem

This is working per spec. The nilKind 'literalCharacter' means the value is nilled if a specified-length element is filled with the literal nil value, which must be a character. However, the length may be far greater than 1, so the notion that the padChar, which can only ever be a single character, matches this field value because it matches the first character, and the whole field is full of that same character, that is too much of stretch. 

When parsing, the DFDL parse algorithm looks for the nil-representation first, and the nil representation for simple type elements when nilKind='literalCharacter' is specified by the DFDL "Data Syntax Grammar" to be NilLiteralCharacters which is a grammar region preceded by NilElementLeftFraming which does not include any padding character region. 

So nilKind 'literalCharacter' excludes consideration of padding chars until the representation has been determined to NOT be nilled. 




> Impossible to have nilled padded string when padChar == nilValue
> ----------------------------------------------------------------
>
>                 Key: DAFFODIL-2285
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2285
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Back End
>            Reporter: Steve Lawrence
>            Priority: Major
>             Fix For: 3.0.0
>
>
> Imagine we have an element like this:
> {code:xml}
>     <xs:element name="elem" type="xs:string"
>       dfdl:lengthKind="explicit" dfdl:length="5"
>       dfdl:textPadKind="padChar"
>       dfdl:textTrimKind="padChar"
>       dfdl:textStringPadCharacter="%SP;"
>       dfdl:textStringJustification="left"
>       dfdl:nilKind="literalCharacter"
>       dfdl:nilValue="%SP;"
>       nillable="true" />
> {code}
> So we have a length 2, space padded string, that should also be considered nill if the entire string is made up of spaces. This does not currently work.
> I *think* the reason is because when when check to see if it's a nil string we first trim off all padding, which results in a zero length string. We then check to see if that string is entirely made up of the space literalCharacter. But because the string is zero length it fails. We may either need to allow zero length string, or special case when nilValue == padValue.



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