Keep 'em coming Chris.
So yes, we're working hard on a enumerations feature for Daffodil that we need in products that have a similar need as yours. They are processing messages, which have lots of numeric enums defined, and we want to translate the enums to symbolic values that are then usable in choiceDispatchKey, and just to make everything more readable in general. The design note is here: https://cwiki.apache.org/confluence/display/DAFFODIL/Proposal%3A+Feature+to+support+enumerations+and+typeValueCalc This feature has become substantially more complicated over time, and we need some experience with it to decide if it can be simplified and still achieve what is needed. This is currently a pull request with some comments for fixup. https://github.com/apache/incubator-daffodil/pull/207 ________________________________ From: Christofer Dutz <christofer.d...@c-ware.de> Sent: Thursday, May 9, 2019 10:19:47 AM To: dev@daffodil.apache.org Subject: Using enumerations for DFDL choices? Hi and sorry for opening all these topics đ But at least that means weâre working hard on utilizing Daffodil đ Sort of all Protocols use some discriminator fields to define whatâs coming up and how to interpret the data. When hand-coding drivers, we usually created Java enums with all the allowed values and were able to use these in the code. With dfdl we are able to define some simpleTypes with restriction and enumeration, but are unable to reference instances of these enumerations. It would be beneficial to for example give every enumeration an id and to use that in the choiceBranchKey ⌠right now it happened not just once, that a numeric value was used which wasnât the expected one. It was then quite difficult to track down what was wrong as itâs not that obvious. Is something like this possible: <xs:simpleType name="CotpTpduType"> <xs:restriction base="plc4x:uint8"> <xs:enumeration value="224" id=â cotpTpduConnectionRequestIdâ> <xs:annotation> <xs:appinfo source="http://plc4x.apache.org/plc4x"> <plc4x:enumName>ConnectionRequest</plc4x:enumName> </xs:appinfo> </xs:annotation> </xs:enumeration> <xs:enumeration value="208" id=â cotpTpduConnectionResponseIdâ> <xs:annotation> <xs:appinfo source="http://plc4x.apache.org/plc4x"> <plc4x:enumName>ConnectionResponse</plc4x:enumName> </xs:appinfo> </xs:annotation> </xs:enumeration> <xs:enumeration value="128" id=â cotpTpduDisconnectRequestIdâ> <xs:annotation> <xs:appinfo source="http://plc4x.apache.org/plc4x"> <plc4x:enumName>DisconnectRequest</plc4x:enumName> </xs:appinfo> </xs:annotation> </xs:enumeration> <xs:enumeration value="192" id=â cotpTpduDisconnectResponseIdâ> <xs:annotation> <xs:appinfo source="http://plc4x.apache.org/plc4x"> <plc4x:enumName>DisconnectResponse</plc4x:enumName> </xs:appinfo> </xs:annotation> </xs:enumeration> <xs:enumeration value="112" id=â cotpTpduErrorIdâ> <xs:annotation> <xs:appinfo source="http://plc4x.apache.org/plc4x"> <plc4x:enumName>Error</plc4x:enumName> </xs:appinfo> </xs:annotation> </xs:enumeration> <xs:enumeration value="240" id=â cotpTpduDataIdâ> <xs:annotation> <xs:appinfo source="http://plc4x.apache.org/plc4x"> <plc4x:enumName>Data</plc4x:enumName> </xs:appinfo> </xs:annotation> </xs:enumeration> </xs:restriction> </xs:simpleType> <xs:complexType name="CotpMessage"> <xs:sequence> <!-- Length of the COTP header data --> <xs:element name="headerLength" type="plc4x:uint8"/> <xs:element name="type" type="s7:CotpTpduType"/> <xs:choice dfdl:choiceDispatchKey="{xs:string(type)}"> <xs:element dfdl:choiceBranchKey="cotpTpduConnectionRequestId" name="cotpTpduConnectionRequest" type="s7:CotpTpduConnectionRequest"/> <xs:element dfdl:choiceBranchKey="cotpTpduConnectionResponseId" name="cotpTpduConnectionResponse" type="s7:CotpTpduConnectionResponse"/> <xs:element dfdl:choiceBranchKey="cotpTpduDisconnectRequestId" name="cotpTpduDisconnectRequest" type="s7:CotpTpduDisconnectRequest"/> <xs:element dfdl:choiceBranchKey="cotpTpduDisconnectResponseId" name="cotpTpduDisconnectResponse" type="s7:CotpTpduDisconnectResponse"/> <xs:element dfdl:choiceBranchKey="cotpTpduErrorId" name="cotpTpduError" type="s7:CotpTpduError"/> <xs:element dfdl:choiceBranchKey="cotpTpduDataId" name="cotpTpduData" type="s7:CotpTpduData"/> </xs:choice> <xs:element name="userData" type="s7:S7Message" minOccurs="0" dfdl:occursCountKind="expression" dfdl:occursCount="{if((../../length - (../headerLength + 5)) gt 0) then 1 else 0}"/> </xs:sequence> </xs:complexType> Is just some pseudo-schema but I hope you get what Iâm trying to do ⌠I want do define the type of âtypeâ and hereby name the branches in order to avoid errors. Chris