Organizing the DFDL model
The third stage of an approach to modeling data by using DFDL involves organizing the DFDL model so that common DFDL property values are declared in a single place and act as defaults for all the components in the schema.
Before you begin
Before you start:Follow the guidance in Understanding the logical structure and Configuring the DFDL annotations.
About this task
All DFDL schemas that are created by the IBM® DFDL wizards and importers follow the practices as described here.
- Set up common DFDL property defaults by using a dfdl:format
annotation at the top level of the schema.
A DFDL schema can be set up so that DFDL properties that are common to multiple schema components need be declared only once, by using a dfdl:format annotation at the top level of the schema itself to declare properties. These properties effectively act as defaults for all components in the schema. (DFDL has no built-in property defaults.)
- A further refinement is to place those properties in a
separate DFDL schema for reuse in other related DFDL schemas.
Create a separate DFDL schema to contain these common DFDL properties, and place them inside a dfdl:defineFormat annotation. This schema is then included into the main DFDL schema through an XSD include or import. The dfdl:format annotation at the top level of the main schema instead uses dfdl:ref to refer to the dfdl:defineFormat. Much like a macro expansion, properties are pulled from the dfdl:defineFormat onto the dfdl:format, where they then act as defaults for all components in the schema in the way described above. In this way, common DFDL properties can be shared across multiple related DFDL schemas.
- Now, you need only to set a handful of properties directly
on each object to complete configuration.