Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

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:

  • 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/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,

  • Edit core/tests/AA.dfdl.xsd in eclipse. Notice that it does not use xmlns="http://www.w3.org/2001/XMLSchema", which is the usual name space for XML Schema. Rather, it uses "http://www.ogf.org/dfdl/dfdl-1.0/XMLSchemaSubset" which provides much more DFDL-oriented schema validation.
  • 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. Notice that it uses xmlns="http://www.w3.org/2001/XMLSchema", which is the usual name space for XML Schema. 
  • 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

Open 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.

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.

  • No labels