Using Eclipse for Editing

A lot has been written about the use of xml as the new hype in structured data definition and the same amount against xml as not human readable and useless for this purpose.
During the same period of time a lot of development took place as well to support easier creation and maintenance of xml resoures. -- And a lot of people who found it a real nono to use xml for testdata are now big fans of the String framework which does a really big deal on xml configuration stuff ;-)

One way to make your live on creating and maintaining xml resources a little bit easier if you are using Eclipse is based on the xml features introduced by the Web Tools Plattform of Eclipse. and the xml editor extension Eclipse XSLT from Orangevolt.

These components combined provide a feature rich xml editor environment a few years back only expensive commercial suites provided.

After installation (please refere to the appropriate installation details on the provided links) first thing to do is to create a valid xml catalog entry of the DDTUnit xml schema file.
To do so

  1. Ppen Window -> Preferences... -> Web and XML -> XML Catalog
  2. Add a new entry under User Entries
    URL: file://<path of local copy of DDTUnit xsd resource
    Key Type: Schema Location
    Key: http://ddtunit.sourceforge.net/ddtunit.xsd

Now you can start to create a new DDTUnit xml resource by creating a new xml file by using xml schema definition:

  1. Open File -> New -> Other... -> XML -> XML (Next)
  2. Create XML file from a XML schema file
  3. Specify file name
  4. Select xml schema file from catalog: key=http://ddtunit.sourceforge.net/ddtunit.xsd
  5. Select details level for element creation and the root element

This finishes the creation process. And as example you find a generated xml resource with all optional elements and attributes created with this editor.

<?xml version="1.0" encoding="UTF-8"?>
&lt;ddtunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="http://ddtunit.sourceforge.net/ddtunit.xsd"&gt;
 <resources>
  <obj calltype="" hint="fields" id="" keytype="string" method="constructor"
   refid="" type="" valuetype="string">
   <description>description</description>
  </obj>
 </resources>
 <cluster id="">
  <description>description</description>
  <objs>
   <obj calltype="" hint="fields" id="" keytype="string" method="constructor"
    refid="" type="" valuetype="string">
    <description>description</description>
   </obj>
  </objs>
  <group id="">
   <test id="">
    <objs>
     <obj calltype="" hint="fields" id="" keytype="string" method="constructor"
      refid="" type="" valuetype="string">
      <description>description</description>
     </obj>
    </objs>
    <asserts>
     <assert action="isTrue" hint="fields" id="" keytype="string"
      method="constructor" refid="" type="" valuetype="string">
      <description>description</description>
     </assert>
     <exception action="isEqual" hint="fields" id="" type="">
      <description>description</description>
     </exception>
    </asserts>
   </test>
  </group>
 </cluster>
</ddtunit>

The last appetizer is the use of element and attribute completion as defined in the xml schema. So if e.g. selecting the xml element <assert > you'll get a list of all possible attributes. - Select action and it will complete to

<assert action="isEqual">
If you select isEqual and hit code completion (Ctrl-Space in standard installation) the list of possible attribute values is provided as selectable drop down listbox.

You are not allowed to stop thinking but this is hell of a lot more convenient than writing all by hand.

sf logo