Exchanger XML Editor

This article or chapter is incomplete and its contents need further attention. Some information may be missing or may be wrong, spelling and grammar may have to be improved, use your judgment!

## Contents

* 1 Introduction
* 2 XML editing
* 2.1 DTD-defined XML
* 2.2 XSD-defined XML
* 3 XSLT Transformation
* 4 XSLT debugging
* 5 Schema development
* 6 Installation tips
* 6.1 Download
* 6.2 Installation on Ubuntu 10 LTS to 18 LTS
* 6.3 Installation on Windows
* 6.4 Installation on Mac
* 6.5 Adaptation to high DPI screens
* 7 Opinions
* 7.1 Opinion of DSchneider

## Introduction[edit | edit source]

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: https://code.google.com/archive/p/exchangerxml/downloads. 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[edit | edit source]

### DTD-defined XML[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

### Download[edit | edit source]

* Download at Google (code.google.com).
* Links from the no longer maintained Exchanger XML Editor website also point to google.com
* Last release: v.3.3.1 (July 2010). Re-tested and installed on Windows 7 64-bit, Windows 8 and Windows 10, Ubuntu 16x and Ubuntu 18x
* Overall, still the best free XML editor IMHO \- Daniel K. Schneider September 2010 / Sept. 2018.

### Installation on Ubuntu 10 LTS to 18 LTS[edit | edit source]

Java must be installed. Under Ubuntu 18, openjdk 10 is fine.

1. Get the zip file version from Google
2. Unzip in an install directory, then run it with:

java -jar xngr-editor.jar &

You then could write a shell script like this (or better)

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

### Installation on Windows[edit | edit source]

We have been using this editor under Windows XP, VISTA, Win7, Win8 and Win10

Make sure that java is installed.

The installer version worked on most configuration. In case it does not, you could install the "zip" version. I do it anyhow on most of my machines, since I don't like "windows" installation using the registry.

Also, sometimes in the past we had to write a short shell script to make it work. 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

### Installation on Mac[edit | edit source]

Since Apple does everything to inhibit use of open source software, installation can be a nightmare. Try the following (tested in Sept. 2018 again):

* Make sure that java is installed.
* Create a new directory called xngr-editor (use this name and not something else, otherwise a path will be broken)
* Copy the zip file into the xngr-editor directory
* Unzip the zip file using the command line, i.e. terminal (the normal Apple unzipper will not work for whatever reason)

unzip .....

* Click on the *.jar file pressing down the `CTRL` key and override the warning you get.

### Adaptation to high DPI screens[edit | edit source]

On windows, one can adapt DPI settings for certain software.

This is crucial if you do not plan to kill your eyesight. It also works with other programs such as Inkscape. Basically, you just lower the screen resolution for just this application. Windows (after updgrades) will complain about this (do not worry).

* Locate the binary `Exchanger XML Editor 3.3.exe` (in principle in `C:\Program Files (x86)\Exchanger XML Editor 3.3`)
* Right-click on `Exchanger XML Editor 3.3.exe`
* Select the `Compatibility` tab
* Click `Change high DPI settings` at the bottom
* Tick `high DPI scaling behavior` and select System

DPI setttings using Windows properties

Note: If the system won't let you:

* Create a shortcut to the desktop, i.e. hold the right mouse button and drag `Exchanger XML Editor 3.3.exe`
* Right-click on the shortcut -> Properties

## Opinions[edit | edit source]

### Opinion of DSchneider[edit | edit source]

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). Also, adapt DPI settings if you got a high resolution (4K) Screen.

As of Sept. 2018, there is still no good free XML editor that provides schema aware editing and XSLT support (i.e. basics for any sort of text-centric XML editing).

- Daniel K. Schneider  September 2010 / August 2018.