Verbosio: An Extensible XML Editor

Imagine: You have a XUL document you're working on, and you want to include SVG graphics in the document. Such a concept is possible only if you have an editor that supports both XUL and SVG editing. You could, of course, edit it with a text editor, but people already design SVG editors, XUL editors, XHTML editors, etc. What if you could have all these editors working together on a single document?

This is Verbosio's goal. Verbosio is an architectural design for overlaying XUL-based editors for XML languages and language-specific documents into a common tool. Using Mozilla's XPInstall technology, Verbosio will allow language-specific tools to combine to give the user a multifaceted XML editing tool.

XML Editing in Three Parts

Verbosio separates the task of editing XML documents into three distinct categories: document makers, view builders, and language packs.

Document makers construct XML documents (and, if extensions are available, non-XML documents, such as JavaScript files or CSS stylesheets). The document maker follows a XUL template's inputs to construct the document and register it with Verbosio. Verbosio then becomes responsible for all operations on the document.

A XML document can be viewed in many different ways. For instance, a document can be seen as source code, a tree of nodes, and as the end-user would actually see it. View builders construct document-specific viewers, which then update when the master document itself is updated, or when the viewer is brought into focus. Thus, the actual document is never directly exposed to the end-user, but they can see the document in many ways.

Language-specific tools for editing XML markup combine into language packs. A language pack gives the end-user tools to alter a document in specific ways, usually by creating new content through a friendly user-interface. For instance, a XUL language pack would likely include a toolbar with a "Menus" dropdown selection. That would then lead to user-interfaces for creating menus, menu items, combo boxes, etc. When the user appropriately fills in the blanks in a XUL-based form, the language pack offers to Verbosio a transaction, which Verbosio then uses to insert the user's requested feature into the XML document.

By this separation of XML powers, Verbosio allows extension modules to clearly define their roles in editing XML. Verbosio itself takes responsibility for the most common operations an editor deals with: file handling, clipboard interaction, undoing and redoing commands, and the like. Thus, extension developers can focus on giving the user more powerful tools, and not on reinventing the most basic features.

Using Preconditions, Not Dialogs

Dialogs are exceedingly annoying to the end-user. There's no reason why an editor couldn't provide a workspace for the user to answer a question or two, instead of popping up a dialog box. Verbosio provides such a workspace, and a <xul:precondition/> element binding for this workspace to replace dialogs.

Verbosio Eats Its Own Dogfood

No XML editor would be worth your time if it couldn't do some basic XML editing out of the box. Verbosio comes with a default set of extensions (one document maker, one language pack, and at least two view builders) to edit generic XML documents. End-users will find these modules useful, while developers can use them as templates for creating their own extensions.

Verbosio Offers Web Services

When an extension module is certified as compatible with Verbosio, it will be added to a website of Verbosio modules. Verbosio can, at the user's discretion or on a regular basis, retrieve additional modules or update currently-installed modules through Mozilla's XPInstall technology.

In addition, if a document type definition is available for a XML document, Verbosio may be able to validate the document through an external Web-based service. (This functionality has not been implemented in Verbosio, but is on the drawing board as a possibility.)

Common, Simple Guidelines for Extensions

Verbosio's design allows extensions to work together without the risk of conflicting with one another or with Verbosio itself. Each extension following Verbosio's guidelines has its own JavaScript scope and XUL element identification scheme. At the same time, implementing extensions should be almost as simple as copying the source code from the original application into new files for Verbosio. Only very minor modifications to an original application's source code should be necessary to overlay the extension into Verbosio.

Verbosio Supports Editing Non-XML Documents

While not a primary goal of Verbosio, editing documents not written in XML is often important. For instance, XUL documents often refer to external JavaScript files and CSS stylesheets. The architecture Verbosio uses for editing XML documents can apply almost as easily to other documents.

Previewing a composite document

XML documents (XHTML and XUL documents in particular) can depend on other documents. Verbosio potentially can preview for the user what changes in external documents affect a document Verbosio has open. (This is a special type of viewer, on the drawing board but not yet implemented.)