| # XMLmind XML Editor - Online Help |

## 7. The "Helper Application Editor" dialog box

This dialog box allows to view or modify a file type listed in the Helper applications preferences sheet.

A file type is specified by at least one of the following characteristic:

MIME type

  The official (or just well-known) formal name of the file type. Generally returned by Web servers to their client Web browsers. Non-registered MIME types typically start with string "`application/x-`".

  A MIME type may end with a wildcard. Example: "`image/*`" matches "`image/gif`", "`image/jpeg`", etc.

  Examples: `text/plain`, `image/jpeg`, `application/excel`, `application/x-java-help-index`.

Filename extension

  If the filename or URL of a file ends with specified "`.`extension``", then this file is detected as having this file type.

  An extension may or may not start with a dot. This is unimportant because, in all cases, a leading dot would be automatically stripped.

  Examples: `txt`, `jpeg`, `jpg`, `xls`.

Magic string

  For some file formats, the first bytes of a file are always the same and therefore, can be considered as being the signature of this file type.

  If a file starts with specified first bytes, then this file is detected as having this file type. This type of detection is supposed to work like magic, hence the name: ``magic string''.

  A magic string may be specified by a the hexadecimal representation of a sequence of bytes (example, one of the two TIFF magic strings: `4949`) or by a quoted sequence of ASCII characters (same example, one of the two TIFF magic strings: `"II"`).

  Examples: TIFF: `"II"` or `4949`, `"MM"`or `4D4D`; GIF: `"GIF87a"`, `"GIF89a"`; PNG: `89504E47`; PDF: `"%PDF-"`.

XML name pattern

  If the root element of an XML file has a name which matches specified pattern, then this XML file is detected as having this file type.

  An XML name pattern follows this syntax:

      ( '{' namespace_URI? '}' )? local_part

  One of `local_part` or `namespace_URI` may be equal to wildcard "`*`"

  Examples: `{*}svg`, `{http://www.w3.org/1998/Math/MathML}:math`.

Each file type has an associated helper application. This helper application is assumed to be able to open files detected as having this type. A helper application may be a viewer or an editor.

Description

  Description of the file type. Not mandatory, just recommended. This text is displayed in the File types list of the Helper applications preferences sheet.

MIME type

  One or more MIME types (see definition above) separated by spaces.

Filename extension

  One or more extensions (see definition above) separated by spaces.

Magic string

  One or more magic strings (see definition above) separated by spaces.

XML name pattern

  One or more XML name patterns (see definition above) separated by spaces.

Helper application

  This field must contain a command line interpreted by the native shell of the platform: `cmd.exe` on Windows and `/bin/sh` on the Mac and on Unix.

  This command line must reference one of these two substituted variables: `%U` and `%F`. In principle, `%U` is replaced by the URL of the file to be opened by the helper application and `%F` is replaced by a filename. In practice, `%U` is just a hint meaning: the helper application can open URLs as well as filenames.

  The Open in XMLmind XML Editor button allows to use XXE as an ``internal'' helper application. For example, associating XXE to `.mml` files allows to edit the MathML documents referenced in a DocBook 4 document.

  This button merely specifies `(xxe) "%U"` (notice the parentheses around `xxe`) as the command template of the helper application. It is of course possible to directly type this command template, or the following read-only variant: `(xxe) -ro "%U"`, in the Helper application field.

  The Choose Helper Application button displays the standard file chooser in order to specify an application (e.g. a `.exe` or a `.bat` file on Windows). String "`"%F"`" is automatically appended to the chosen application.

  ### Helper applications on the Mac

  When an application (that is, a folder having a name ending with hidden suffix "`.app`", containing a package bundle) has been selected by the user, the Choose Helper Application button automatically prepends:

  - for a version older than Mac OS X 10.5 (e.g. Tiger): "`open -a`",

  - starting from Mac OS X 10.5 (Leopard): "`open -W -n -a`".

    Example: "`open -W -n -a /Applications/Inkscape "%F"`".

    Options "`-W -n`" mean: start a new instance of the application and wait until this instance has exited. These options are required when the helper application is used to edit the content of an element, the content of an attribute or the whole document.

  In practice, this means that, on Mac OS X versions older than 10.5, a helper application can only be used for viewing purposes and this, even if the helper is an editor.