Integrating an External XProc Engine
Oxygen XML Editor includes a bundled version of the Calabash XProc engine that can be used for XProc transformations and validation, but you can also integrate other external XProc engines. When you edit an XProc transformation scenario, there is a Processor drop-down menu where you can select the XProc engine to be used for the transformation.
If you do not need the external XProc engine to be used for automatic validation or pass parameters/ports and it is not Java-based, you can simply add the external engine by using the XProc preferences page. Otherwise, if the external engine is Java-based, or it has validation support, or it can receive parameters or ports passed from the transformation, you need to integrate it using the plugin extension procedure below.
For example, there is a public project on GitHub that is an implementation for integrating Morgana XProc with Oxygen XML Editor: https://github.com/xml-project/support-for-xmleditor. Also, the Javadoc documentation of the XProc API is available for download from the application website as a zip file: xprocAPI.zip.
To create an XProc integration project, follow these steps:
- Move the oxygen.jar file from [OXYGEN_INSTALL_DIR]/lib to the lib folder of your project.
- Implement the ro.sync.xml.transformer.xproc.api.XProcTransformerInterface interface.
- Create a Java archive (JAR) from the classes you created.
-
Create an engine.xml file according to the
engine.dtd file. The attributes of the
<engine>
element are as follows:- name - The name of the XProc engine.
- description - A short description of the XProc engine.
- class - The complete name of the class that implements ro.sync.xml.transformer.xproc.api.XProcTransformerInterface.
- version - The version of the integration.
- engineVersion - The version of the integrated engine.
- vendor - The name of the vendor / implementer.
- supportsValidation - true if the engine supports validation (otherwise, false).
The
<engine>
element has only one child,<runtime>
. The<runtime>
element contains several<library>
elements with the@name
attribute containing the relative or absolute location of the libraries necessary to run this integration. - Create a new folder (for example, named MyXprocEngine) and place the engine.xml and all the libraries necessary to run the new integration in that folder.
-
Place that new folder (e.g. MyXprocEngine) inside a new plugin
folder. This new plugin folder should also contain a plugin.xml file
that points to the new engine folder (e.g. MyXprocEngine).
The plugin.xml file would look like this (it is based on the AditionalXProcEngine extension):
<plugin id="morgana.xproc.addon" name="Contribute Morgana XProc" description="Contribute Morgana XProc" version="1.0" vendor="Syncro Soft" class="ro.sync.exml.plugin.Plugin" classLoaderType="preferReferencedResources"> <extension type="AdditionalXProcEngine" path="MyXprocEngine/"></extension> </plugin>