Jaxe, your XML editor
Jaxe, your XML editor

Documentation for end users
• XML principles
• Definition of an XML language
• Launching Jaxe
• Using Jaxe
• Jaxe equations syntax
• Preferences

# Using Jaxe

Author: Damien Guillaume

## Configuration files

At startup, Jaxe opens a new XML document with the default configuration if there is only one configuration file. If there is more than one, a dialog is displayed to choose a configuration file corresponding to an XML language. To check that the XML language in an opened document is the one you want to use, just look at the menus: the elements menubar is located under Jaxe menus (which are on top of the screen on MacOS). If it is not the right language, choose a configuration file with the Open configuration... menu. When an XML file is opened, Jaxe is automatically using the configuration file corresponding to its XML language (when it exists).

Jaxe includes example configuration files for XHTML strict, Docbook, simplified Docbook, XPAGES, and an XML language for presentations. Your administrator has normally prepared another configuration file for the XML language you will use.

## Elements display

XML elements can be displayed in many different ways in Jaxe, and it is even possible to create new display types. The way elements are displayed is defined in Jaxe's configuration file for the chosen XML language. However, some display types are more popular than others. A classic display type consists in a start tag, followed by the element content, and finishing with an end tag. For instance, a date can be displayed like that :

With this display type, when an element has attributes, buttons appear on the tags to allow their modification in a dialog. If validation icons are activated in the preferences, the tags also contain an icon indicating if the element is valid or not (an element can for instance be invalid if required sub-elements are missing inside). These icons are however not indispensable, because the tags also change of color when an element is invalid.

Other display types are for instance lists, tables, images (for elements linking to image files), or forms.

## Elements insertion

When a configuration file is opened, Jaxe prepares a new document, and automatically inserts the root element (when XML documents have only one root element), displaying a dialog for its attributes if it has attributes. The menubar corresponds to the elements in the XML language, and can be used to insert elements. Another way to insert elements is the insertion panel, which appears on the left of the text area. It gives a list of the elements that can be inserted in the text where the cursor is. This list can also be obtained with the contextual menu, which is opened on the Mac with a control-click, or with a right click with a multi-button mouse. It can also be displayed by typing cmd-D (on a Mac) or ctrl-D (Linux/Windows), in order to avoid moving the hands off the keyboard.

It is also possible to insert an element around a text or a set of elements already entered. This is done by selecting this set, and inserting the element as would be done normally.

## Elements removing

To remove an element, place the cursor after one of the tags (or another graphic object if the element is not displayed with start and end tags) and press the delete key. Be careful, this deletes the whole element, with everything inside ! In case of catastrophe, do not forget the cancel menu.

## Attributes

Some elements have attributes (i.e. a set of name/value strings). When a new element with attributes is inserted, a dialogue is displayed to choose the attribute values. To change them later, just click on the start tag's attribute button, or place the cursor within the element and look at the Attributes panel. Optional attributes have a name in green, while required attributes are in red.

## Images

Many XML languages have elements corresponding to images. With these XML languages, it is possible to paste an image in Jaxe, which creates automatically the image file in the same directory as the XML file, and creates an XML element with the reference to the new image file. The attributes dialogue for image elements has two more buttons, Select a file... and Copy a file.... These buttons are used to select a file and (with the copy button) to copy the image file near the XML file. It is better in general to avoid absolute references to files, such as `/Users/toto/x.gif`, and to use paths relative to the directory containing the XML file instead. It is good to create a directory for each XML file, and to create a directory inside to contain the image files referenced by the XML file. The reference to the image file then becomes `images/x.gif`.

## Equations

Jaxe features a simple equation editor, to easily insert and modify equations. It opens with elements corresponding to equations. The editor has two areas: one at the bottom, where the equation is written as simple text, and one at the top, where the the graphic representation is displayed bit by bit.

For instance, when `sqrt(2)/3` is typed, the equation's image is displayed : . The editor syntax is described in the next page.

## Search and replace

Words in the text can be found and replaced with the Find menu in the Edit menu. It is possible to do advanced searches with the XPath syntax to select XML element with their name and their attribute values. It is not necessary to know XPath to use this feature: a sub-dialog can be used to build simple requests. It is for instance easy to search for a `SECTION` element with a given `title` attribute.

## Spell checking

Jaxe includes the Jazzy spell checker. Before using it, make sure you have downloaded a dictionary and moved it in the dicos directory. The British English dictionary is made up of two files, `British.dico` and `British.phon`. Then, select a dictionary with the preferences by choosing the `.dico` file. You can then use the Spelling... menu in the Edition menu.

## Displaying source code

It is possible to display the XML file source code, as it will be saved, with the XML source menu. The XML source window is not editable so as to avoid update problems.

## Validation

Jaxe creates valid XML files, but it is possible to prepare an XML file that is not yet valid (because a required element has not yet been added, in which case the parent element is displayed in orange), or to open an invalid file. In this case, it is possible to start a validation, which is done based on the XML schema (the validation is not useful when the simplified syntax has been used to define the language). This can be done with the Validation menu. When there are errors, they are displayed in a list, and a click on an error shows the location in the XML window.

## HTML preview

An HTML preview can be created if a stylesheet has been created for the XML language. The preview is generated with the HTML Window menu. It is displayed within Jaxe, but not necessarily well if CSS is used (Java Swing is only able to display HTML 3 so far !). So, it may be necessary to open the HTML file with a web browser, which is done easily with a button on the HTML window after the web browser has been selected in the preferences. In the latest version of Jaxe, the HTML window directly opens in the web brower chosen in the preferences.