
For our next conference call, I said I would walk through the Apache Daffodil newVariableInstance feature, and how for unparsing we had to add a direction property to variables so they can be evaluated with forward referencing for unparsing. The code I'd like to discuss is here: https://github.com/DFDLSchemas/PCAP/blob/cb9ee66aa565d982f01130918bcd785def5... The defineVariable that is the best motivating example is defined at line 104, and is used at line 213. This is a simple common-subexpression elimination, but it is used to avoid redundant calls to dfdl:valueLength in the dfdl:outputValueCalc of the stored length field named InclLen. There is a second example of using newVariableInstance at unparse time in this schema also, with the variable definitions starting at line 115, and usage in the group defined starting at line 320. This usage is far more complex, and in hindsight I think a DFDL parse of PCAP data should not be creating IP addresses in the Infoset that look like "1.2.3.4", because it requires all this complexity to unparse from that back to the binary representation. However, it is a good exercise in how the newVariableInstance feature works. -mikeb 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 <http://www.ogf.org/About/abt_policies.php>