Child pages
  • Eclipse Settings for DFDL Schema Authoring/Editing
Skip to end of metadata
Go to start of metadata

The Eclipse IDE can be used to assist a user in the authoring of DFDL schemas.

See also Installing Eclipse.

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

There are XML-Schema-Aware editors. So, if you have an editor that is aware of the XML Schema of an XML document, then that editor can provide intelligent assistance in authoring the XML document. It can show you the XML source code, or can show you diagrammatic ways of examining the 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.

Since there is an XML Schema for the XML Documents that just happen to be DFDL Schemas, an XML aware editor can provide assistance in authoring DFDL Schemas.

This page contains instructions for setting up the Eclipse Integrated-Development-Environment (IDE), and to configure it's XML editing features so that they provide some level of support for authoring DFDL schemas. In theory, based on this, if you have some other favorite XML-Schema-Aware editing environment, you could figure out how to enable it to provide you similar DFDL schema authoring assistance.

Installing Eclipse XML Features

The XML settings all assume you have installed Eclipse's XML support. Given an Eclipse update site for your version of Eclipse, the  "Eclipse XML Editors and Tools" software is what you need, and what this page is referring to for XML settings.

Eclipse XML Settings

(Caveat: The menu locations often vary from one Eclipse release to the next.)

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

  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 extensions tdml
      6. Click Finish
      7. Repeat steps i-vi, replacing tdml with dfdl.xsd
  2. Window > Preferences > General > Content Types
    1. Select Text > XML
    2. Click Add...
    3. Set Content type to *.dfdl.xsd
    4. Repeat steps b-c with content type set to *.tdml
  3. Window > Preferences > XML > XML Files > Editor
    1. Uncheck Format comments
  • No labels

2 Comments

  1. Also: Window->Preferences->XML-> XML Catalog.

    Edit the catalog to associate the URL for XML Schema with the XML Schema for DFDL. Like so, replacing the prefix of the uri (platform:/resource/daffodil-lib/src/main/resources/xsd) by the location where you have placed the schema file. You must use a URI (meaning spaces are %20, etc.)

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
      <uri name="http://www.ibm.com/xmlns/dfdl/testData" uri="platform:/resource/daffodil-lib/src/main/resources/xsd/tdml.xsd"/>
      <public publicId="-//W3C//DTD XMLSCHEMA 200102//EN" uri="platform:/resource/daffodil-lib/src/main/resources/xsd/XMLSchema.dtd"/>
      <public publicId="datatypes" uri="platform:/resource/daffodil-lib/src/main/resources/xsd/datatypes.dtd"/>
      <uri name="http://www.w3.org/2001/XMLSchema" uri="platform:/resource/daffodil-lib/src/main/resources/xsd/XMLSchema_for_DFDL.xsd"/>
      <uri name="http://www.ogf.org/dfdl/dfdl-1.0/" uri="platform:/resource/daffodil-lib/src/main/resources/xsd/DFDL_part3_model.xsd"/>
    </catalog>
    
    

    That DTD entry is probably not needed, but the others are.

  2. There is a specific challenge here. A DFDL schema refers to the XSD namespace using the original XML Schema URI, not a DFDL-specific URI. This is essential for a DFDL schema to be an XML Schema.

    To get a tool to provide help with the DFDL-subset of XML Schema; however, this original XML Schema URI must be mapped to the subset-schema for DFDL's subset of XSD.

    Many tools seem to special case XSD. That is, they do not provide any ability to provide ones own XML schema for a file with extension ".xsd", nor any way to remap the schema associated with the XML Schema URI.  Without this, one must rename DFDL schema files to say ".dfdl.xml", so the tool will treat them as regular XML files, not XSD files. One must also potentially edit the URI used for the XML Schema namespace, and use a different URI that can be mapped to the schema for DFDL schemas. Each time one edits the file this change to the URI would be required. This becomes infeasible for a schema that is spread out over many files.

    Lastly, once you make these settings changes for a given XML authoring tool, you will find that tool fairly useless for editing regular XML Schemas (that are not DFDL schemas). So one will need two separate configurations of the tool.