XMLmind XML Editor - Developer's Guide

Hussein Shafie

Pixware

Immeuble Capricorne,
23 rue Colbert,
78180 Montigny Le Bretonneux,
France,
Phone: +33 (0)1 30 60 07 00,
Fax: +33 (0)1 30 96 05 23,
Web: www.xmlmind.com/xmleditor
Email: 

July 21, 2008

Abstract

This guide describes how to embed an XML editor based on XXE components into another application, how to write a command, a validation hook, a style sheet extension, an image toolkit plug-in, etc. For experienced Java™ programmers only.


Table of Contents

1. Introduction
1. Compiling and running code samples
2. Creating your own extensions
2. Embedding a XML editor in an application - Part I/II
1. Assembling the GUI
2. The NodePath component
2.1. What is a NodePath?
2.2. Using the NodePath to trigger Commands
2.3. Using menus and tool bars to trigger Commands
3. Loading a document
3.1. Opening a document
3.2. Closing a document
4. Updating the GUI
4.1. Enabling and disabling menu items
4.2. Being notified when the document is modified
4.3. Being notified when the editing context changes
5. Saving a document
6. Validating a document
7. Printing a document
3. Embedding a XML editor in an application - Part II/II
1. Main difference between StyledEditor and SimpleEditor
2. What is a ViewFactory?
3. Configuring the TreeViewFactory in SimpleEditor
4. The Style menu of StyledEditor
4.1. StyleSheetInfo
4.2. Changing the style sheet of a StyledDocumentView
4. Programming the Document Object Model
1. Names and Namespaces
2. Document nodes
3. Document traversal
4. Loading and saving a document
5. XML node properties
5. Using XPath
1. The two implementations of XPath contained in XMLmind XML Editor
2. Compiling and evaluating an XPath expression
2.1. XNode
2.2. Two steps: parse and evaluate
2.3. ExprContext
3. XPath value types
3.1. evalAsNumber
3.2. evalAsBoolean
3.3. evalAsNodeSet
3.4. evalAsVariant
4. Matching a node against an XPath pattern
6. Writing a command
1. What is a command?
1.1. The CommandBase base class.
2. A sample command: ConvertCaseCmd
2.1. First step: prepare
2.2. Second step: execute
2.3. Reporting errors from commands
3. Adding bindings to the XML editor
7. More commands
1. Highlighting text
1.1. Marks other than dot, mark, selected and selected2
1.2. Description of prepare
1.3. Step by step description of execute
2. A validating command
2.1. ElementEditor
2.2. Step by step description of prepare
2.3. Step by step description of execute
3. How to avoid writing a validating command
3.1. Delegating node insertion to the ubiquitous Paste command
3.2. Step by step description of prepare
3.3. Step by step description of execute
4. Recordable commands
8. Writing style sheet 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 style sheet extensions
9. Writing a validateHook
1. Implementing the ValidateHook interface
10. Writing a plug-in
1. Steps needed to write, package and deploy a plug-in
2. Packaging an add-on for XMLmind XML Editor integrated add-on manager
2.1. Creating useful add-on descriptors
11. Extending the GUI of XMLmind XML Editor
1. A framework for creating XML editors
2. High-level building blocks
3. The custom parts needed to create the GUI of the tutorial part of XMLmind XML Editor - Customizing the User Interface
3.1. A custom About dialog box
3.2. A custom tool which counts the words found in the active document
3.2.1. How to count words in an XML document?
3.2.2. Best strategy
3.2.3. The word counter tool
3.3. A custom preferences sheet which parametrizes the word counter

List of Figures

1.1. The Create Project wizard
2.1. SimpleEditor
2.2. NodePath
2.3. Edit popup menu
2.4. PreferredPrefixDialog
2.5. AttributeTool
2.6. DiagnosticsTool
3.1. StyledEditor
3.2. Options menu
3.3. Style menu
8.1. A message having a 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