Chapter 1. What is a command?
Prev | Part I. Guide | Next

## 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 File|Open have been made available as commands. For example, the command corresponding to menu entry File|Open is called XXE.open. But other menu entries such as File|Print are not (yet) available as commands. For example, you cannot invoke File|Print from a custom tool bar and you cannot invoke File|Print 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 command) need to be declared in an XXE configuration file (see XMLmind XML Editor - Configuration and Deployment). Example:

        <command name="xhtml.preview">
          <class>com.xmlmind.xmleditapp.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 of commands need to be specified in an need to be declared in an XXE configuration file (see Section 2, “command” in XMLmind XML Editor - Configuration and Deployment). Example:

        <command name="contextualMenu1">
          <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" />

            <editMenu />
          </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 need to be specified in an XXE configuration file (see Section 2, “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 containing one or more of the following elements: `convertImage`, `processFO`, `upload`, `print`, `zip`, `jar`, `post`, work only in XMLmind XML Editor Professional Edition.

  Process commands need to be specified in an XXE configuration file (see Section 2, “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>

Prev | Up | Next
Part I. Guide | Home | Chapter 2. Writing macro-commands