Eclipse Configuration for DFDL Schema Authoring/Editing

The Eclipse IDE can be used to assist a user in the authoring of DFDL schemas. This page contains instructions for setting up the Eclipse Integrated-Development-Environment (IDE), and to configure its XML editing features so that they provide some level of support for authoring DFDL schemas.

DFDL extends a subset of XML Schema. Note however: an XML Schema is an XML document.

Now, turns out there is an XML Schema for DFDL Schemas. It was created by taking the XML Schema for XML Schemas, and subsetting it to just what DFDL uses, and then adding into it the XML Schema for DFDL’s annotation objects.

Installing Eclipse XML Plugin

The XML settings all assume you have installed Eclipse’s XML support. If not already installed, the “Eclipse XML Editors and Tools” plugin can be Eclipse’s update site.

Eclipse XML Settings

Following are steps to modify the Eclipse XML settings to aid in the creation of DFDL schemas:

Enable Validation of DFDL Files

  1. Window > Preferences > Validation
    1. Turn off XML Schema Validator
    2. Turn off DTD Validator
    3. Click the … settings box to the right of XML Validator
      1. Select Include Group
      2. Click Add Rule
      3. Select File Extension
      4. Click Next
      5. Add extension: dfdl.xsd
      6. Click Finish
  2. Window > Preferences > General > Content Types
    1. Select Text > XML
    2. Click Add…
    3. Set Content type to *.dfdl.xsd
  3. Window > Preferences > XML > XML Files > Editor
    1. Uncheck Format Comments

If also editing TDML file in Eclipse, repeat the above steps, replacing all instances of dfdl.xsd with tdml.

Add XML Schemas for DFDL to the XML Catalog

Download the following files to a local directory. Alternatively, these files are included in the Daffodil source code in the src/main/resources/edu/illinois/ncsa/daffodil/xsd/ directory in either daffodil-lib/ or daffodil-propgen/.

Modify the Eclipse settings to reference these files:

  1. Windows > Preferences > XML > XML Catalog
  2. For each of the following files, select ‘Add..’ and provide the location on the ‘File System…’ or ‘Workspace…’, along with the key and key type

    File Key Type Key
    XMLSchema.dtd Public ID -//W3C//DTD XMLSCHEMA 200102//EN
    datatypes.dtd Public ID datatypes
    XMLSchema_for_DFDL.xsd URI http://www.w3.org/2001/XMLSchema
    DFDL_part3_model.xsd URI http://www.ogf.org/dfdl/dfdl-1.0/
    tdml.xsd URI http://www.ibm.com/xmlns/dfdl/testData