[DFDL-WG] Clarification: Unparser choice branch selection (section15.1.3)

Bradd Kadlecik braddk at us.ibm.com
Fri Mar 20 14:36:13 EDT 2020


My parser handles that by requiring the  switching of the order of the
sequence statements.  The empty branch is taken as the first branch when no
elements are found from other branches.  I think that's in keeping with the
spec.  I of course defer to Steve tho.


                                                                                   
 Regards,                                                                          
                                                                                   
 Bradd Kadlecik                                                                    
 z/TPF Development                                                                 
                                                                                   
                                                                                    
                                                                                    
                                                                                    
 Phone: 1-845-433-1573                                                2455 South Rd 
 E-mail: braddk at us.ibm.com                                         Poughkeepsie, NY 
                                                                         12601-5400 
                                                                      United States 
                                                                                    







From:	Mike Beckerle <mbeckerle.dfdl at gmail.com>
To:	DFDL-WG <dfdl-wg at ogf.org>
Date:	03/20/2020 12:54 PM
Subject:	[EXTERNAL] [DFDL-WG] Clarification: Unparser choice branch
            selection (section	15.1.3)
Sent by:	"dfdl-wg" <dfdl-wg-bounces at ogf.org>




We have choices like this:

<choice>
  <sequence>
    <sequence dfdl:hiddenGroupRef="PI_true"/>

    <sequence>
       <element name="foo" minOccurs="0" ...../>
       <element name="bar" minOccurs="0" ..../>
  </sequence>

  <sequence dfdl:hiddenGroupRef="PI_false"/>

</choice>



PI_true and PI_false are presence indicator flags.


When unparsing, if you have element "foo" or "bar" in the infoset, then the
first branch is selected, and the PI_true flag is unparsed.


The problem is when neither "foo" nor "bar" is in the infoset. Note that
both are optional above.


In that case, we want the PI_false branch to be chosen.


So point 1: The DFDL spec (section 15.1.3)  is unclear about how a choice
branch is chosen if it contains no visible element.


Possible fix 1: One reasonable clarification might be that the first branch
that admits no elements when unparsing would be chosen.


Possible fix 2: Another reasonable clarification would be that a branch
with no possible elements is preferred to branches that have possible
elements. If there is more than one such branch, the first would be chosen.


Maybe there are other possible fixes?


Daffodil currently is implementing possible fix 2, but that's not
necessarily right. It maintains backward compatibility with older
daffodil-oriented DFDL schemas.


If we decide Fix 1 is better, then we would have to put in a backward
compatibility flag defaulting to true that enables users to continue to use
schemas written as above, but we'd have to revise schemas like the above to
reverse the order of the branches, and eventually flip the state of the
flag to require use of these new reordered schemas.


Thoughts?








Mike Beckerle | OGF DFDL Workgroup Co-Chair | Owl Cyber Defense |
www.owlcyberdefense.com
Please note: Contributions to the DFDL Workgroup's email discussions are
subject to the OGF Intellectual Property Policy
--
  dfdl-wg mailing list
  dfdl-wg at ogf.org

https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ogf.org_mailman_listinfo_dfdl-2Dwg&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=Gr_9muStjOfOwiy6fErdWcH5wgoRUAPlQRqBfOga1GA&m=erDuahYfFtpPq19AUm20nn4zZbLlx-LgSHrHU477jK4&s=_2Vtb18d20gKAnr9ddt7bJEZcCFCOIQcg57LZy61Lug&e=


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20200320/53331a82/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20200320/53331a82/attachment.gif>


More information about the dfdl-wg mailing list