Exchanger XML Editor

The educational technology and digital learning wiki
Jump to navigation Jump to search

<pageby nominor="false" comments="false"/>

Introduction

Exchanger XML editor is an XML editor. I use it in various course settings where I either teach XML or use XML - Daniel K. Schneider 2010 - 2015. As of nov. 2010, the last release was v.3.3.01 (June 2010). It is available through a "Google code" repository. It seems that the company who developed the initial version is inactive and that they made their code open source. This "new" free version includes the XSLT debuger, something that the free V3.2 version did not...

As of July 2015, Exchanger XML editor is still the best free general purpose XML code editor. It offers schema support and includes an XSLT debugger and a whole lot of editing tools that we will not describe here. Other free editors may better suit precise purposes such as DocBook editing.

Main Features:

  • DTD/Schema aware editing
  • Wellformedness checking and validation
  • XSLT Support (including a good tracer/debugger)
  • DTD/XSD/RNG conversion tools
  • Xinclude resolver
  • Multi-platfrom (Java-based).

This editor is quite well documented (press the Help item in the menu bar). Below we just will write down a few essential tricks.

XML editing

DTD-defined XML

Very important: Exchanger has a little bug that requires you to define a well-formed XML file with a correct header and an inserted root element before you start editing. This is a quite "normal requirement". But, then you must close this *.xml file and re-open it again in order to make the editor DTD aware. In other words, if you don't create this skeleton, then close and open it again, the editor will not help you with XML editing as described below.

A typical skeleton looks like this, i.e. it would include XML declaration on top, follow by a schema declaration and and inserted root element.

<?xml version="1.0"?>
<!DOCTYPE recipe SYSTEM "cooking.dtd">

<recipe>

</recipe>

Below is a screenshot of the V3.3. editor:

(To do: annotate this picture ...

To insert an element:

  • As in the screen shot above, select the Editing helper pane to the left by clicking on (*>) . Then (in the editing window) click on the element tag you wish to edit or put your cursor in a location between child element. The helper pane will then display available elements on which you can click to insert.
  • Or, in the contents window press press Ctrl-T to insert an element.
  • Or, pressing "<" in the editing window gives more options and you can do it in any place.

To insert an attribute:

  • Click on a tag name of an element. Then click on an attribute on top of the helper pane to the left
  • or position the cursor after the element name (but remain within the tag itself). Then press the space bar

The order of elements (works only with DTD's but not with XSD's) is shown in the top pane to the left. You may have to fiddle with options in the XMLmenu if your XSD Schema is not attached in the right way.

Soft wrapping (important for text-centric XML)

  • Menu: View -> Editor Properties Select

XSD-defined XML

Editing a documented based on and XSD follows the same principle as using a DTD, however associating an XSD with a XML file is somewhat more tricky.

XSLT Transformation

When you develop an XSLT style sheet, it is important to verify that correct HTML (or whatever other kind of output) is being produced. To do so, you can use the built-in XSLT processor that is available through the Transform menu.

Suggested procedure

  • Open your XML file (not the xslt file as many beginners do ....)
  • Then use menu Transform->Execute Advanced XSLT...

This procedure allows to use a style-sheet processing declaration of your XML file, e.g. something like this:

<?xml version="1.0"?>
<!DOCTYPE recipe SYSTEM "cooking.dtd">
<?xml-stylesheet href="cooking.xsl" type="text/xsl"?>

For output, either choose new document or file. Choose file, if you plan to validate the output

In addition (truly important !), it seems that only the Saxon 2.0 processor is working in the V3.3.1 edition. Therefore you must define the right processor. You can do this by clicking on the Processor button as shown in the figure below, but we rather suggest to change the global preferences in Menu file->Preferences; XML Tab. Saxon 2.0 is probably the best XSLT processor anyhow.

XSLT Processor settings (important)

Of course, in other situations you may choose other options, e.g. you don't need to open the files in the editor, they don't even need to be on your computer.


For Mac users: in some cases, even if you opened the right document (xml), the XSLT transformation doesn't work (apparently after an incorrect installation) so try selecting Open document instead of Current document in Execute Advanced XSLT window, and choose the xml file you need to transform.

XSLT debugging

The included XML debugger can be used at two levels

  • Beginners just can open it and have a look at the processing traces, i.e. understand what elements are dealt with by which templates and in what order. Also, the result (e.g. HTML) is displayed.
  • Advanced users can insert breakpoints (right-click next to a number) and then inspect bindings.

To launch it:

  • Menu Transform->XSLT Debugger
Screen shot of the Exchanger XSLT Debugger

Schema development

The Schema menu allows:

  • Validation of DTD, XSD and RNG. It is crucial to use this feature when you develop a schema.
  • Schema conversion from XML, DTD or RNG to XSD

Installation tips

Download

Exchanger V3.3.1, installed without problems under Windows 7 64 bit (oct. 2010/DKS)

Installation on Ubuntu 10.0 LTS

  1. Get xngr-editor.zip xngr-editor.zip a Zip file
  2. Unzip in an install directory, then run it with:
java -jar xngr-editor.jar &

Write a shell script like this (or better) for version 3.3.01 (Summer 2010)

#! /bin/bash
cd /usr/local/xngr
java -jar xngr-editor.jar &

For the older version 3.2 you had to:

#! /bin/sh
cd /usr/local/exchanger
java -jar lib/xngr-loader.jar &

Installation on Windows Vista

  • Installer did't work for me at some point (Vista professional). Maybe V 3.3. works, but I can't tell since I moved to Win 7.
  • I had to take the zip version (see above) and then write a 2-line shell script. Contents of file xngr.cmd:
rem Change to the path where you extracted the zip
cd c:\soft\xngr 
start javaw -jar lib\xngr-loader.jar

Opinions

Opinion of DSchneider

Editing is fairly ergonomic, DTD-based XML editing support is ok, XSD-based XML editing support could be improved (does not display information about element structure). There are many additional tools (some useless for beginners but of interest to advanced users). So this is my best choice for a free structure editor.

Only major problem: It does not propose elements in the right order (DTD rules are displayed, but XSD no). This is a problem with almost all editors I have seen. An exception that does this better is Framemaker (an expensive word processor).

Addition (Feb 2007). I used this editor in a 8 weeks XML beginner's class and indeed it was a good choice. I also liked the XSLT support. There is a validator and editing support for major XSL and XSD elements. Also, I found out that one can format text (Menu Edit->XML->Format). This is crucial when confronted with ugly student productions :).

Xchanger was again updated on June 2010 (version 3.3). It still remains the best overal choice for teaching introductory XML (DTD,XSLT,XSD etc.). Only caveat: Make sure to change the XSLT processor option to Saxon 2.0 (the others won't work) - Daniel K. Schneider 15:10, 20 September 2010 (CEST).