XMLmind XML Editor - Developer's Guide

Hussein Shafie

XMLmind Software

35 rue Louis Leblanc,
78120 Rambouillet,
France,
Phone: +33 (0)9 52 80 80 37,
Web: www.xmlmind.com/xmleditor
Email:  (public mailing list)

March 22, 2024

Abstract

XMLmind XML Editor (XXE for short) can be customized/extended substantially without having to write a single line of code. However there are some cases where programming against the Java™ API of XXE becomes inevitable. This document covers all the extension points of XXE, from writing commands to extending the GUI of XXE. For experienced Java™ programmers only.


Table of Contents
1. Introduction
1. What you'll learn
2. Compiling and running the code samples
I. Commands
2. Commands
1. The prepare and execute methods
1.1. A very simple, sample command
2. Making a command repeatable and recordable
3. Getting acquainted with XXE native DOM
1. A sample program making use of XXE native DOM
2. Compiling and running the sample program
4. Sample commands
1. Sample command ConvertCaseCmd
1.1. First step: prepare
1.2. Second step: doExecute
2. Sample command ShowMatchingCharCmd
2.1. How it works
2.2. First step: prepare
2.3. Second step: doExecute
3. Sample command WrapElementCmd
3.1. How it works
3.1.1. Using an ElementEditor
3.2. First step: prepare
3.3. Second step: doExecute
4. Sample command MakeParagraphsCmd
4.1. How it works
4.2. First step: prepare
4.3. Second step: doExecute
5. Compiling and testing the sample commands
II. Other extensions found in configuration files
5. Custom validation hook
1. A sample validation hook
2. Compiling and testing the sample validation hook
6. Custom attribute editor
1. A sample attribute editor
2. Compiling and testing the sample attribute editor
III. CSS stylesheet extensions
7. All stylesheet extension points
1. Stylesheet extension class
2. Stylesheet extension method
3. StyleSpecs, an object which knows about the intrinsic styles of an element
4. Custom view components managed by CustomViewManager
5. ComponentFactory
6. GadgetFactory
7. StyledElementViewFactory
8. Sample stylesheet extensions
1. The problem
2. The solution
2.1. Solution of problem #1: invoke a custom method computing a CSS property value
2.1.1. The StyleSheetExtension class
2.1.2. The localize method
2.2. Solution of problem #2: implement a StyleSpecs which knows how to style nested emphasis elements
2.2.1. The implementation of interface StyleSpecs
2.3. Solution of problem #3: invoke a custom method computing the number of a listitem and use a BasicElementObserver to update orderedlists when needed to
2.3.1. Interface BasicElementObserver
2.3.2. The implementation of interface BasicElementObserver
2.4. Solution of problem #4: implement an AttributeValueEditor
2.4.1. Passive custom views
2.4.2. Active custom views: specialized editors embedded in the DocumentView
3. Compiling and testing the sample stylesheet extensions
IV. Plug-ins
9. Virtual drive plug-in
10. Image toolkit plug-in
11. XSL-FO processor plug-in
12. Document format plug-in
13. Spell checker plug-in
V. Extending the GUI of XXE
14. Application parts
1. XXE, a multi-document, multi-view per document, XML editor
2. XXE is specified as an assembly of AppParts
15. Sample application parts
1. A custom About dialog box
2. A custom tool which counts the words found in the active document
2.1. How to count words in an XML document?
2.2. Best strategy
2.3. The word counter tool
3. A custom preferences sheet which parametrizes the word counter
4. Compiling and deploying these sample custom parts
A. Packaging an add-on for XMLmind XML Editor integrated add-on manager
1. Why packaging add-ons?
2. Creating useful add-on descriptors
B. Porting an XXE v9 command to XXE v10
List of Figures
5.1. Errors [1], [3], [5], [6] are reported by the sample validation hook. (Errors [2], [4] are reported by the stock validation engine.)
8.1. A message having an xml:lang="fr" attribute
8.2. In the three following paragraphs, nested emphasis elements (containing words "nested emphasis text") are displayed using a non-italic font
8.3. Two orderedlists, the second one having a continuation="continues" attribute
8.4. Four smiley elements represented by four comboboxes
15.1. The Count Words preferences sheet