Function: xml-mode
xml-mode is a function alias and interactive for nxml-mode, defined in
nxml-mode.el.gz.
Signature
(xml-mode)
Documentation
Major mode for editing XML.
C-c / (nxml-finish-element) finishes the current element by inserting an end-tag.
C-c C-i closes a start-tag with > and then inserts a balancing end-tag
leaving point between the start-tag and end-tag.
C-c C-b (nxml-balanced-close-start-tag-block) is similar but for block rather than inline elements:
the start-tag, point, and end-tag are all left on separate lines.
If nxml-slash-auto-complete-flag is non-nil, then inserting a </
automatically inserts the rest of the end-tag.
M-x completion-at-point (completion-at-point) performs completion on the symbol preceding point.
C-c C-d (nxml-dynamic-markup-word) uses the contents of the current buffer
to choose a tag to put around the word preceding point.
Sections of the document can be displayed in outline form. The
variable nxml-section-element-name-regexp controls when an element
is recognized as a section. The same key sequences that change
visibility in outline mode are used except that they start with C-c C-o
instead of C-c.
Validation is provided by the related minor-mode rng-validate-mode(var)/rng-validate-mode(fun).
This also makes completion schema- and context- sensitive. Element
names, attribute names, attribute values and namespace URIs can all be
completed. By default, rng-validate-mode(var)/rng-validate-mode(fun) is automatically enabled.
You can toggle it using M-x rng-validate-mode (rng-validate-mode) or change the default by
customizing rng-nxml-auto-validate-flag.
TAB (indent-for-tab-command) indents the current line appropriately.
This can be customized using the variable nxml-child-indent
and the variable nxml-attribute-indent.
C-c C-u (nxml-insert-named-char) inserts a character reference using
the character's name (by default, the Unicode name).
C-u (universal-argument) C-c C-u (nxml-insert-named-char) inserts the character directly.
The Emacs commands that normally operate on balanced expressions will
operate on XML markup items. Thus C-M-f (forward-sexp) will move forward
across one markup item; C-M-b (backward-sexp) will move backward across
one markup item; C-M-k (kill-sexp) will kill the following markup item;
C-M-@ (mark-sexp) will mark the following markup item. By default, the
complete element is treated as a single markup item; to make each tag be
treated as a separate markup item, set the variable nxml-sexp-element-flag
to nil. For more details, see the function nxml-forward-balanced-item.
C-M-u (nxml-backward-up-element) and C-M-d (nxml-down-element) move up and down the element structure.
Many aspects this mode can be customized using
M-x customize-group (customize-group) nxml RET.
In addition to any hooks its parent mode text-mode might have run,
this mode runs the hook nxml-mode-hook, as the final or penultimate
step during initialization.
Probably introduced at or before Emacs version 22.1.
Key Bindings