eForms Expression Language (EFX)
The eForms Expression Language (EFX) is the language of the eForms SDK for three tasks: computing values from the data of a notice, validating notices, and displaying them.
An EFX expression names the data of a notice by the identifiers of the fields and nodes of the SDK, such as
BT-21-Procedure, not by the structure of the XML document. So expressions are short, and they stay valid when the
XML structure of the notice changes. Each expression is read from a place in the notice, its
context, so a reference to a field gives the value that belongs to that place. EFX is also typed: every value has a
data type, such as text, number or date, and the types are checked before any notice is read.
EFX does not run on its own. Applications translate it into a language that they can run, such as XPath, XSLT or Schematron. They usually translate it once, when they import a new version of the SDK, and not each time they process a notice.
The three flavours of EFX
EFX comes in three flavours, one for each task:
- EFX Expressions
-
Expressions compute a value from the data of a notice. You use them on their own, and inside the other two flavours.
- EFX Templates
-
Template files describe how a notice is displayed.
- EFX Rules
-
Rules files describe how a notice is validated.
The EFX Language Reference describes each flavour in detail.
EFX in the SDK
| Where | What |
|---|---|
|
The conditions and assertions of the field constraints, for example the conditions under which a field is mandatory or forbidden. Each of them is a single expression (see Single expression and Field metadata). |
|
The view templates, written in EFX Templates (see View Templates). |
|
The validation rules, written in EFX Rules. |
|
The grammar of the language (see EFX grammar). |
Documentation
The EFX Language Reference describes the language construct by construct: what each construct is for, how you write it, what it does, and which restrictions apply. It is for everyone who reads or writes EFX.
EFX-1 and EFX-2
SDK 2 uses EFX-2. SDK 1 used EFX-1, which is described in the documentation of the SDK 1 versions, for example SDK 1.15. The appendix Changes from EFX-1 lists the differences.
Tools
- EFX grammar
-
The formal grammar of EFX. With the tool ANTLR 4, you can generate from it a program that reads EFX, in one of several programming languages.
- EFX Toolkit for Java
-
A library that translates EFX expressions, templates and rules. The Publications Office uses it in its own applications.
- Notice Viewer sample application
-
A sample application that displays notices with the view templates of the SDK, translated with the EFX Toolkit.