2. command
Prev | Chapter 7. Configuration elements | Next

## 2. command

    <command
      name = NMTOKEN
    >
      Content: class | menu | macro | process
    </command>

    <class>
      Content: Java class name
    </class>

Register command specified by `class`, `macro` or `process` with XXE. The newly registered command can be referenced in binding `command` or `menu`, menu `item`, toolBar `item` and command `macro` using name `name`.

All commands are registered in the same global registry using name `name`. Therefore, it is strongly recommended to use a prefix (not related to XML namespace prefixes) for the name of your commands. Example of commands written by XMLmind: `docb.moveListItemUp`, `docb.moveListItemDown`, `wxs.crossReference`, `wxs.tableColumn`, `wxs.tableRow`. (We always use `short_lower_case_prefix`.`camelCaseCommandName`.)

Example:

      <command name="xhtml.preview">
        <class>com.xmlmind.xmleditapp.xhtml.Preview</class>
      </command>

In the above example, custom command `com.xmlmind.xmleditapp.xhtml.Preview` written in Java is registered by XXE under the name `xhtml.preview`.

Child elements of `command`:

class

  Register command implemented in the Java™ language by class `class` (implements interface `com.xmlmind.xmledit.gadget.Command` -- See Chapter 6, Writing a command in XMLmind XML Editor - Developer's Guide).

menu

  Define 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. See Chapter 3, Menu commands in XMLmind XML Editor - Commands.

macro

  Define a macro-command which is, to make it simple, a sequence of native commands, menu commands, process commands or other macro-commands. See Chapter 4, Macro commands in XMLmind XML Editor - Commands.

process

  Define a process command, which is an arbitrarily complex transformation of part or all of the document being edited. See Chapter 5, Process commands in XMLmind XML Editor - Commands.

Prev | Up | Next
1. binding | Home | 3. configuration