Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-2262

occursCountKind 'expression' should avoid separator suppression, but does not.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.0
    • 2.5.0
    • Back End
    • None

    Description

      Reported on users mailing list.

      Section 14.2.2 of the DFDL specification says this:

      When dfdl:occursCountKind is 'expression' the number of occurrences is given by dfdl:occursCount and exactly that many occurrences are always expected along with their separators. The dfdl:separatorSuppressionPolicy is not applicable and the implied behaviour is 'never'.

      The below schema has dfdl:occursCountKind="expression" and yet I am not observing the expected implied behavior of 'never'. That is, with this input:

      header1,header2
       a,

      After parsing and then unparsing I get this:

      header1,header2
       a

      Notice that the comma separator has been suppressed after ‘a’ but the specification says that the implied behavior is to never suppress the separator. This seems like a bug to me. Do you agree? 

      <xs:element name="input">
           <xs:complexType>
               <xs:sequence dfdl:separator="%NL;" dfdl:separatorPosition="infix">
                   <xs:element name="header">
                       <xs:complexType>
                           <xs:sequence dfdl:separator="," dfdl:separatorPosition="infix"  dfdl:separatorSuppressionPolicy="anyEmpty">
                               <xs:element name="title" maxOccurs="unbounded" type="xs:string" />
                           </xs:sequence>
                       </xs:complexType>
                   </xs:element>
                   <xs:element name="row" maxOccurs="unbounded">
                       <xs:complexType>
                           <xs:sequence dfdl:separator="," dfdl:separatorPosition="infix" dfdl:separatorSuppressionPolicy="anyEmpty">
                               <xs:element name="field" maxOccurs="unbounded" type="xs:string"
                                   dfdl:occursCount="{ fn:count(../../header/title) }"
                                   dfdl:occursCountKind="expression" />
                           </xs:sequence>
                       </xs:complexType>
                   </xs:element>
               </xs:sequence>
           </xs:complexType>
       </xs:element>

       

      Attachments

        Activity

          People

            dfthompson Dave Thompson
            mbeckerle Mike Beckerle
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: