Chapter 1. What is a command?

A command is an action which occurs in the view of a document, styled or not. This action is triggered by a keystroke, mouse click, custom tool bar button (example: the XHTML tool bar) or custom menu entry (example: the DocBook menu).

Some menu entries of XMLmind XML Editor such as FileOpen have been made available as commands. For example, the command corresponding to menu entry FileOpen is called XXE.open. But other menu entries such as FilePrint are not (yet) available as commands. For example, you cannot invoke FilePrint from a custom tool bar and you cannot invoke FilePrint from a macro-command.

Almost all commands can be passed a parameter string which is used to parametrize the behavior of the command. The syntax of this parameter string and its exact effects are totally command specific. Therefore there is nothing more to say about these parameter strings except that you'll need to read the reference manual of all native commands to check what is supported and what is not.

There are four types of commands:

Commands written in the Java programming language

All generic commands written in the Java™ programming language are predefined: you don't need to declare them.

All XML application specific commands written in the Java™ programming language (XMLmind XML Editor - Developer's Guide describes how to write such commands) need to be declared in an XXE configuration file (see XMLmind XML Editor - Configuration and Deployment). Example:

<command name="xhtml.preview">
  <class>com.xmlmind.xmleditext.xhtml.Preview</class>
</command>
Menu commands

A ``menu command'' is a popup menu of commands. This special type of command, typically invoked from contextual macro-commands, is intended to be used to specify contextual popup menus, redefining or extending the standard right-click popup menu.

Menu commands must be specified in an XXE configuration file (see Section 4, “command” in XMLmind XML Editor - Configuration and Deployment). Example:

<command name="convertCaseMenu">
  <menu>
    <item label="To Upper Case"
          command="convertCase" parameter="upper" />
    <item label="To Lower Case" 
          command="convertCase" parameter="lower" />
    <item label="Capitalize Words" 
          command="convertCase" parameter="capital" />
  </menu>
</command>
Macro-commands

A macro-command is, to make it simple, a sequence of native commands, menu commands, process commands or other macro-commands.

Macro-commands must be specified in an XXE configuration file (see Section 4, “command” in XMLmind XML Editor - Configuration and Deployment). Example:

<command name="xhtml.convertToLink">
  <macro>
    <sequence>
      <command name="convert" parameter="a" />
      <command name="putAttribute" parameter="%*" />
    </sequence>
  </macro>
</command>
Process commands

A process command is an arbitrarily complex transformation of part or all of the document being edited.

Process commands must be specified in an XXE configuration file (see Section 4, “command” in XMLmind XML Editor - Configuration and Deployment). Example:

<command name="toSimpara">
  <process>
    <copyDocument selection="true" to="in.xml" />
    <transform stylesheet="simpara.xslt" cacheStylesheet="true"
               file="in.xml" to="out.xml" />
    <read file="out.xml" encoding="UTF-8" />
  </process>
</command>