Next / Previous / Contents / Shipman's homepage

5. Special emacs commands

The previous section discusses how schema location files work to help emacs find the right schema for your file. If the default rules work for your case, you can proceed immediately to edit your file.

However, if you want to create a file that does not match any of the rules in the default schema location file, you have two choices.

When you create a new XML document file, if your file doesn't have one of the file suffixes that automatically triggers nxml-mode (such as .xml or .xsl), you can put emacs into nxml-mode manually with M-x nxml-mode.

Below are all the special keystrokes available in nxml-mode. As in the emacs reference guide, the prefix C- means control and M- meta (either combine with alt or prefix with esc).

Also, these terms have their usual emacs meanings:

5.1. Schema commands

C-c C-s C-t If you are creating a new document in one of the supported standard document types, you can start your document with this command. You will be prompted in the minibuffer for the document type string. Type one of these strings for the supported standard types: DocBook, RDF, RELAX NG, XHTML, or XSLT. You can use tab for completion in the minibuffer. Then emacs will ask you if you want to save that schema association in your local schemas.xml file.
C-c C-s C-w Asks what schema you are using. If your document is connected with a schema, the path to the schema appears in the minibuffer. If no schema is in effect, you will get the message “Using vacuous schema”.
C-c C-s C-f Manually selects a schema for the current document. You will be prompted in the minibuffer with “Schema file: ” followed by the current directory's path. Edit the minibuffer to reflect the path to the schema you want, then press enter.
C-c C-s C-a If you are using a root element that is defined in the schema selection files, you can connect your document to the schema by typing just the “<” and tag name for the root element, then typing C-c C-a. This tells emacs to go through the schema selection process again, and if the root element matches any of the rules, emacs will know what schema you want.
C-c C-s C-l Add a rule to the local schema locator file schemas.xml that connects the current document to its schema.