Contents

Setup XML

Getting eclipse to validate DFDL Schemas using its XML validation capabilities requires some configuration. Without this you will get hundreds (at least) of XML and XML Schema validation errors from the daffodil code base.

There is a single file of interest to this located in your dfdl git repository:

IMPORTANT: You'll likely need to split out into two distinct workspaces and two distinct copies of Eclipse.

Import XML Catalog

  1. Open Eclipse.
  2. Select File -> Import -> XML -> XML Catalog.
  3. Browse to and select daffodil-lib/src/main/resources/daffodil-built-in-catalog.xml. Click OK.

Setup XML Validation Settings

In Eclipse:

Select Window -> Preferences

Select Validation. Verify that the following are NOT checked at all: DTD Validator, HTML Syntax Validator, XML Schema Validator.

Your selections should look similar to the following:

Click the "..." button next to XML Validator.  The following window should pop-up:

  1. Select the first "Include Group".  Then click "Add Rule". A Rule Wizard will pop-up.
  2. The "File extension" radio button should be selected.  Click Next.
  3. In the next screen type "tdml" (without quotes) into the text field. Click Finish.
  4. Repeat this process in order to add 'dfdl.xsd' and 'dfdl.xml'.

 

  1. Select "Exclude Group".  Click "Add Rule".  The Rule Wizard will pop-up.
  2. Select the "Folder or file name" radio button.  Click Next.
  3. In the next screen, type "target" (without quotes) into the text field.
  4. Check the "Is the comparison case sensitive?" check box. Click Finish.
  5. Repeat this process in order to add 'doc'.

 

  1. Select "Add Include Group".  Then click "Add Rule".  A Rule Wizard will pop-up.
  2. Select the "Folder or file name" radio button.  Click Next.
  3. Type "resources" (without quotes) into the text field.
  4. Check the "Is the comparison case sensitive?' check box.
  5. Click Finish.

Your "Validation Filters for XML Validator" window should now look similar to the one pictured above.

Click OK.

You should now be back at the "Validation" screen.  Click Apply.  Click OK.

Associate TDML Files With The XML Editor

In Eclipse:

Window -> Preferences -> General -> Content Types

Under 'Content types' click Text.  This will expand.

Click XML.

Text will appear under 'File associations'.  To the right of this box click Add.

In the pop-up enter "*.tdml" without quotes as pictured below.

Click OK.

Under 'File associations' you should now see "*.tdml".

In the left menu, select Editors -> File Associations.

Click 'Add'.  Enter "*.tdml" in the text field of the pop-up as pictured below.

Click OK.

Under 'File types' you should now see "*.tdml".

Select "*.tdml" and look at the 'Associated editors' field.  

If it contains "XML Editor", you are done and may click OK.  Otherwise, you'll need to add it:

Click 'Add'.  Select "XML Editor".  Click OK.

Click 'Add'.  Select "Text Editor".  Click OK.

Click OK.

Test It Out

With the settings and XML Catalog above, you can edit DFDL Schemas, and get support from Eclipse.

For example,

Contrarywise....

Setup Linked Resources

In Eclipse:

You need to describe where you cloned the daffodil repository.  To do so, perform the following:

  1. Go to Window -> Preferences -> General -> Workspace -> Linked Resources
  2. Under 'Defined path variables', click 'New...'
  3. Enter DAFFODIL_ROOT as the Name
  4. Enter the path to the daffodil repository in Location
  5. Click OK twice.

Setup Unix-Style Line Endings

In Eclipse:

  1. Go to Window -> Preferences -> General -> Workspace
  2. In the bottom right of the window you'll see 'New text file line delimiter'.
  3. Select 'Other'.
  4. In the drop-down, select 'Unix'.
  5. Click Apply.
  6. Click OK.

Unicode Setup

Windows

A US install normally doesn't default to a Unicode friendly environment.  One of the features of the Scala programming language is that it is completely unicode aware.

But, to make a USA windows default install of Windows itself, and Eclipse unicode friendly you have to take a few steps.

  1. Open Eclipse.
  2. From the top menu bar Select Window -> Preferences
  3. A dialog box will pop-up.  In the left pane navigate to General -> Workspace.
  4. Under 'Text file encoding' choose 'Other' and select 'UTF-8' from the drop down as pictured below:

Click Apply.

Do not exit this dialog as of yet.

From the left pane select General -> Appearance -> Colors and Fonts

For the text font (bottom of list usually), change it to Courier New by clicking Edit and selecting Courier New.  This font has many of the glyphs for unicode characters in it.

Click OK.

Click Apply.

Click OK.

In the Package Explorer.  Select all of the daffodil projects. (Click the first daffodil project.  Hold Shift.  Click the last daffodil project. Release Shift.)

Right-click the first daffodil project.

Select Refresh.

Close Eclipse.

Lastly to complete the Unicode setup you have to install some updates that allow windows to display certain Unicode characters correctly:

  1. From the Windows Start Menu, click Control Panel.
  2. In the Control Panel select System and Settings -> Windows Update.
  3. Here you will want to make sure to show all hidden updates as you will need to install one of them if you haven't already.
  4. Choose the Japanese language pack.  Install it.  Reboot

Linux

On Linux, UTF-8 and good unicode fonts are the default. Nothing to do here.