Chapter 12. Creating a self-contained xxe.jar file

Table of Contents

1. Using deployxxe to create a a self-contained xxe.jar file
2. Optional JAR files

1. Using deployxxe to create a a self-contained xxe.jar file

The stock xxe.jar file found in XXE_install_dir/bin/ contains only the code of XMLmind XML Editor. It is used to run the XMLmind XML Editor (XXE) desktop application[12] and would not be convenient to use if you want to embed an XML editor based on XXE in your application.

In order to embed an XML editor in your application, you'll first have to create a single, self-contained xxe.jar files containing everything needed to run XXE:

  • Some of the JAR files found in XXE_install_dir/bin/: xxe.jar, relaxng.jar, resolver.jar.

  • All the add-ons you'll need in your application. Stock add-ons such as: document type configurations (DITA, DocBook, XHTML), a spell-checker engine, spell-checker dictionaries, translations of XXE messages, virtual drive plug-ins, image toolkit plug-ins, etc, but also, custom add-ons if needed to.

Procedure 12.1. A step by step description of how to create the xxe.jar file adapted to the needs of your application:

  1. Install a fresh copy of the XMLmind XML Editor desktop application anywhere you want. Let's suppose you have installed it in /opt/xxe/.

  2. IMPORTANT: uninstall all the add-ons you don't need by using OptionsInstall Add-ons in XMLmind XML Editor - Online Help.

    For example, you'll probably want to uninstall all the XSL-FO processor plug-ins (FOP, XMLmind XSL-FO Converter) and also the "Edit source" and "Paste from Word" add-ons.

  3. Optionally install extra add-ons by using OptionsInstall Add-ons in XMLmind XML Editor - Online Help.

    Installing in-house add-ons

    You can install an in-house add-on (for example, an in-house configuration allowing to use XXE to edit proprietary XML documents) simply by copying its top-level directory to /opt/xxe/addon/.

    However if you do this, do not forget to clear the Quick Start cache (OptionsPreferences, Advanced|Cached Data section in XMLmind XML Editor - Online Help), then restart XXE. If you forget to do that, XXE will fail to see your in-house add-on.

  4. Test your copy of XXE by running it normally, as a desktop application.

  5. Run XXE_install_dir/bin/deployxxe:

    $ deployxxe embed /tmp/out

    The above deployxxe in XMLmind XML Editor - Configuration and Deployment command creates a directory called /tmp/out/ and generates a number JAR files in this directory. You can ignore all these JAR files, except /tmp/out/xxe.jar.

    This generated xxe.jar file is less than 15Mb large for an XXE runtime containing the DITA, DocBook 4 & 5 and XHTML configurations, a spell-checker engine and the English dictionary for this spell-checker engine.

  6. Copy the generated xxe.jar file to your project workspace in order to add it to the CLASSPATH of your application.

    In the vast majority of cases, you'll need only the above xxe.jar file. The following section explains why you may need to add extra JAR files to the CLASSPATH of your application.

2. Optional JAR files

In addition to the self-contained xxe.jar file, you may need to add one or more of the following JAR files to the CLASSPATH of your application. All the following JAR files are found in XXE_install_dir/bin/.

xerces.jar

The JAR file of Xerces 2.9.1+. Not useful unless you need to edit documents making use of general entity references.

The XML parser (which is Xerces too) included in the Java 1.6+ runtime has bugs related to general entity references[13]. Note that there are no such bugs in recent versions of Xerces obtained from the Apache Software Foundation.

saxon.jar

Contains the code of Saxon 6.5.5, an XSLT 1 engine. Not useful unless the XML editor you embed has a "Convert Document" submenu.

Note that, by default, XMLPanel, XMLPanel2 and XMLFrame have no "Convert Document" submenu.

saxon9.jar

Contains the code of Saxon 9.5+, an XSLT 2 engine. Not useful unless the XML editor you embed has a "Convert Document" submenu.

Note that, by default, XMLPanel, XMLPanel2 and XMLFrame have no "Convert Document" submenu.



[12] Remember that the desktop application dynamically discovers and loads its JAR files during its startup. Therefore a self-contained xxe.jar file would not useful for the desktop application.

[13] In some cases, the boundaries of general entity references are not reported correctly.