Next: Nroff Mode, Previous: TeX Mode, Up: Text
The major modes for SGML, XML, and HTML provide indentation support
and commands for operating on tags. XML mode is actually identical to
SGML mode (to be precise, xml-mode is an alias for
sgml-mode), because XML is a strict subset of SGML. HTML mode
is a slightly customized variant of SGML mode.
In XML, every opening tag must have an explicit closing tag. When
the variable sgml-xml-mode is non-nil, the tag insertion
commands described below always insert explicit closing tags as well.
When you visit a file, Emacs determines whether it is XML by examining
the file contents, and sets sgml-xml-mode accordingly.
sgml-tag).
This command asks you for a tag name and for the attribute values,
then inserts both the opening tag and the closing tag, leaving point
between them.
With a prefix argument n, the command puts the tag around the
n words already present in the buffer after point. Whenever a
region is active, it puts the tag around the region (when Transient
Mark mode is off, it does this when a numeric argument of −1 is
supplied.)
sgml-attributes).
sgml-skip-tag-forward).
A numeric argument acts as a repeat count.
sgml-skip-tag-forward). A numeric argument acts as a repeat
count.
sgml-delete-tag). If the tag at or after point is an opening
tag, delete the closing tag too; if it is a closing tag, delete the
opening tag too.
sgml-tag-help). If the argument tag is empty, describe
the tag at point.
sgml-close-tag). If called from within a tag or a comment,
close this element instead of inserting a close tag.
sgml-name-8bit-mode).
sgml-validate).
Emacs also provides a more advanced mode for editing XML
documents, called nXML mode (nxml-mode). nXML mode is aware of
many existing XML schema, and uses them to provide completion of XML
elements via C-<RET> or M-<TAB>, as well as
“on-the-fly” validation of XML, with errors highlighted via Font
Lock (see Font Lock). It is described in its own manual.
See nXML Mode.