How is a test expression tested?

50 views Asked by At

dfdl has assert and discriminator, each of which will allow a "test expression" to be the value of test. e.g.,

<dfdl:assert test="{test expression}" />

but all the documentation says about "test expressions" is about what happens when they pass or fail. meanwhile, if you look through the official daffodil repository for GIF by mitre, gif.dfdl.xsd includes lines like

<dfdl:discriminator test="{(Byte1 eq 33) and (Byte2 eq 249)}"/>  

which implies to me that it just sends the test to the shell (i.e., bash? powershell on windows? cmd on windows?) to "test" a test expression.

Is that right? if not, how does it test them? what's the language for these test expressions?

1

There are 1 answers

0
stevedlawrence On BEST ANSWER

Test expressions use the "DFDL expression language", which is a subset of XPath 2.0. Section 18 of the DFDL specification (https://daffodil.apache.org/docs/dfdl/#_Toc322911718) details the language syntax and supported functions.

Daffodil implements a custom expression parser and evaluator in Scala (which it internally calls DPath) to efficiently support DFDL expressions.