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

Mike McGann updated DAFFODIL-2205:
----------------------------------
    Description: 
This bug report is based on a message Roger Costello posted to the Daffodil 
Users group.

>From the DFDL specification, when emptyValueDelimiterPolicy is set to 'none':
{quote}'none' indicates that if the content region is empty neither the

dfdl:initiator or dfdl:terminator must be present. On unparsing when

the content region is empty nothing will be output.
{quote}
 Based on the above, if in the schema an element has an initiator and a 
terminator, and if the emptyValueDelimiterPolicy is set to 'none', to represent 
an empty value neither the initiator nor the terminator should be present in 
the input.

 In the attached test case,
 * the element *MiddleName* has an initiator and a terminator
 * *emptyValueDelimiterPolicy* is set to 'none'
 * For the test input, John,,Doe we are getting the parse error: [error] Parse 
Error: Found out of scope delimiter: ',' ','
 * Test input John,(),Doe parses successfully

{code:xml}
  <xs:element name="input">
    <xs:complexType>
      <xs:sequence
          dfdl:separator=","
          dfdl:separatorPosition="infix"
          dfdl:separatorSuppressionPolicy="trailingEmpty">
        <xs:element
            name="FirstName"
            type="xs:string" />
        <xs:element
            name="MiddleName"
            type="xs:string"
            dfdl:initiator="("
            dfdl:terminator=")"
            dfdlx:emptyElementParsePolicy="treatAsEmpty"
            dfdl:emptyValueDelimiterPolicy="initiator" />
        <xs:element
            name="LastName"
            type="xs:string" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

{code}
 

 Input:

John,(),Doe – parse successful

John,,Doe – Parse error.

[error] Parse Error: Found out of scope delimiter: ',' ','

 

 The files used for testing this scenario are attached.

It also appears that it does not work for 'initiator' and 'terminator' as well 
so this ticket will be about implementing this feature instead of fixing a bug. 

 

  was:
This bug report is based on a message Roger Costello posted to the Daffodil 
Users group.

>From the DFDL specification, when emptyValueDelimiterPolicy is set to 'none':
{quote}'none' indicates that if the content region is empty neither the

dfdl:initiator or dfdl:terminator must be present. On unparsing when

the content region is empty nothing will be output.
{quote}
 Based on the above, if in the schema an element has an initiator and a 
terminator, and if the emptyValueDelimiterPolicy is set to 'none', to represent 
an empty value neither the initiator nor the terminator should be present in 
the input.

 In the attached test case,
 * the element *MiddleName* has an initiator and a terminator
 * *emptyValueDelimiterPolicy* is set to 'none'
 * For the test input, John,,Doe we are getting the parse error: [error] Parse 
Error: Found out of scope delimiter: ',' ','
 * Test input John,(),Doe parses successfully

{code:xml}
  <xs:element name="input">
    <xs:complexType>
      <xs:sequence
          dfdl:separator=","
          dfdl:separatorPosition="infix"
          dfdl:separatorSuppressionPolicy="trailingEmpty">
        <xs:element
            name="FirstName"
            type="xs:string" />
        <xs:element
            name="MiddleName"
            type="xs:string"
            dfdl:initiator="("
            dfdl:terminator=")"
            dfdlx:emptyElementParsePolicy="treatAsEmpty"
            dfdl:emptyValueDelimiterPolicy="initiator" />
        <xs:element
            name="LastName"
            type="xs:string" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

{code}
 

 Input:

John,(),Doe – parse successful

John,,Doe – Parse error.

[error] Parse Error: Found out of scope delimiter: ',' ','

 

 The files used for testing this scenario are attached.

 


> emptyValueDelimiterPolicy only works per specification for 'both' 
> ------------------------------------------------------------------
>
>                 Key: DAFFODIL-2205
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2205
>             Project: Daffodil
>          Issue Type: Bug
>    Affects Versions: 2.4.0
>         Environment: Daffodil 2.4 on Windows 10
>            Reporter: Shashi Ramaka
>            Assignee: Mike McGann
>            Priority: Major
>             Fix For: 3.5.0
>
>         Attachments: bug01-input-fails.txt, bug01-input-works.txt, 
> bug01.dfdl.xsd
>
>
> This bug report is based on a message Roger Costello posted to the Daffodil 
> Users group.
> From the DFDL specification, when emptyValueDelimiterPolicy is set to 'none':
> {quote}'none' indicates that if the content region is empty neither the
> dfdl:initiator or dfdl:terminator must be present. On unparsing when
> the content region is empty nothing will be output.
> {quote}
>  Based on the above, if in the schema an element has an initiator and a 
> terminator, and if the emptyValueDelimiterPolicy is set to 'none', to 
> represent an empty value neither the initiator nor the terminator should be 
> present in the input.
>  In the attached test case,
>  * the element *MiddleName* has an initiator and a terminator
>  * *emptyValueDelimiterPolicy* is set to 'none'
>  * For the test input, John,,Doe we are getting the parse error: [error] 
> Parse Error: Found out of scope delimiter: ',' ','
>  * Test input John,(),Doe parses successfully
> {code:xml}
>   <xs:element name="input">
>     <xs:complexType>
>       <xs:sequence
>           dfdl:separator=","
>           dfdl:separatorPosition="infix"
>           dfdl:separatorSuppressionPolicy="trailingEmpty">
>         <xs:element
>             name="FirstName"
>             type="xs:string" />
>         <xs:element
>             name="MiddleName"
>             type="xs:string"
>             dfdl:initiator="("
>             dfdl:terminator=")"
>             dfdlx:emptyElementParsePolicy="treatAsEmpty"
>             dfdl:emptyValueDelimiterPolicy="initiator" />
>         <xs:element
>             name="LastName"
>             type="xs:string" />
>       </xs:sequence>
>     </xs:complexType>
>   </xs:element>
> {code}
>  
>  Input:
> John,(),Doe – parse successful
> John,,Doe – Parse error.
> [error] Parse Error: Found out of scope delimiter: ',' ','
>  
>  The files used for testing this scenario are attached.
> It also appears that it does not work for 'initiator' and 'terminator' as 
> well so this ticket will be about implementing this feature instead of fixing 
> a bug. 
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to