Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

See also Installing Eclipse and Configure Eclipse - Part 1.

This is additional Eclipse configuration - particularly to get XML aspects of Eclipse working reasonably.

This page assumes you have installed Eclipse' XML support, i.e., the "Eclipse XML Editors and Tools" software. If this is not already installed in your Eclipse instance, you can install it from the update site for your version of Eclipse.

Contents

Table of Contents
excludeContents

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:

  • daffodil-lib/src/main/resources/daffodil-built-in-catalog.xml

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/target/eclipse/classes/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:

Image Removed

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

Image Removed

  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

Image Removed

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.

Image Removed

Click OK.

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

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

Image Removed

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

Image Removed

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,

  • Edit core/tests/AA.dfdl.xsd in eclipse.
  • Note that the file extension ".dfdl.xsd" is the standard way to identify a DFDL schema file.
  • Change one of the dfdl:inputValueCalc properties and misspell the property name. Save the file and you should see a validation error.
  • Validation using the DFDL XML Schema Subset URL will validate short form and long form DFDL annotations, and enforce DFDL's subset of XML Schema.

Contrarywise....

  • Edit core/tests/AH.dfdl.xsd in eclipse.
  • Note that the file extension ".dfdl.xsd" is the standard way to identify a DFDL schema file.
  • Change one of the dfdl:inputValueCalc properties and misspell the property name. Save the file and you will NOT see any validation error.
  • Change one of the attributes of the dfdl:defineVariable element, such as remove the name attribute and put in a ref="foo" attribute. Save, and you should see a validation error.
  • Validation using the standard XML Schema URL will NOT validate short form DFDL annotations, nor will it care if you put a long form annotation element named dfdl:foobar. But if you do get the name of a DFDL annotation element correct, then it will validate the properties on that annotation element.

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.

See Setup Microsoft Windows for Unicode, to insure your MS Windows installation can properly cope with Unicode characters.

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:

Image Removed

Click Apply.

Do not exit this dialog as of yet.

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

Image Removed

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.

Image Removed

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.

Linux

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

Page content removed (obsolete). See https://cwiki.apache.org/confluence/display/DAFFODIL/Eclipse+Tricks+and+Notes