In binary mode, xs:boolean is defined by the DFDL specification as having an implicit length on 32 bits. This is described by table 18 in section 12.3.3 https://daffodil.apache.org/docs/dfdl/#_Toc398030743
<https://daffodil.apache.org/docs/dfdl/#_Toc398030743> I do not know what the reasoning behind this decision was. The way to specify a 1-byte boolean would be to set dfdl:lengthKind="explicit" and dfdl:length="1" ________________________________ From: Costello, Roger L. <[email protected]> Sent: Wednesday, June 19, 2019 2:06:20 PM To: [email protected] Subject: What is the proper way to describe in DFDL an input field that holds a boolean value? Hello DFDL community, The specification for my input file says this about a field: Name: isSimulation Type: Byte Description: always set to 0 (false) I tried describing that input field using this DFDL: <xs:element name="isSimulation" type="xs:boolean" dfdl:binaryBooleanTrueRep="1" dfdl:binaryBooleanFalseRep="0" /> Parsing the 1-byte input field results in this error message: [error] Parse Error: Insufficient bits in data. Needed 32 bit(s). Eek! 32 bits? Why are 32 bits needed for the xs:boolean datatype? It seems like 1 bit should be enough. What is the proper way to describe in DFDL the input field? /Roger
