%FEDORA-ENTITIES-EN; ]> Emacs and nXML Mode nXML Emacs Emacs nXML mode You can also use the nXML mode available for Emacs to make it even easier to write in DocBook XML format. nXML mode provides context-sensitive editing using completion, real time validity error checking, syntax highlighting and indentation. All you need to do is install an RPM!! Early stages Please be aware the nxml-mode for Emacs is quite new, so there are a few things that the advanced user might notice when using it with other documents types. If you keep an eye on the mailing-list, you can keep up to date with these, as well as ask questions. For more details, check out .
Getting the nXML RPM nXML RPM nXML RPM To use nXML mode with emacs, you will need to install the nXML RPM available from Tim Waugh's website or the source from http://www.thaiopensource.com/download/. The source requires a lot more work to setup, therefore we will only be concentrating on the RPM version. Information on where to get the source is available in .
Examples Compared to PSGML mode there are only couple of commands that you need. This speeds up writing with Emacs considerably, which means you can concentrate more on the content of your article.
Commands To create a tag, type < and then type the keyword. To complete the keyword, press Ctrl-Ret, then add the last >. To close a tag, type </. Important When you open a document that doesn't have a DOCTYPE declaration at the top of the file, you will get this message and tag completion won't work because nXML will not know what format you are writing. To load the schema, type Ctrl-c, then Ctrl-s and navigate to /usr/share/emacs/site-lisp/nxml-mode/schema/ and load docbook.rnc. Emacs will then prompt you to save it in the current working directory. Tip The commands already discussed are the only differences between using Emacs with PSGML mode and Emacs with nXML mode. You will still need to use all the same commands as discussed in .
Additional Resources Additional Emacs and nXML references are available at the following locations: http://www.thaiopensource.com/download/Author's download area http://wks.uts.ohio-state.edu/unix_course/intro-135.htmlEmacs Quick Reference Guide Emacs reference card that comes with the emacs package. You can print it out as a reference. — /usr/share/emacs/<version>/etc/refcard.ps
nXML README File Note This file can be found in the directory you extracted the source into, or in /usr/share/doc/nxml-mode-<version>/ if you installed the RPM. README file: This is a new major mode for GNU Emacs for editing XML documents. It supports editing well-formed XML documents and also provides schema-sensitive editing of XML documents using RELAX NG Compact Syntax. To use this, you need GNU Emacs version 21.x, preferably 21.3. GNU Emacs version 20 will not work properly, nor will XEmacs. To get started, do the following: M-x load-file RET rng-auto.el RET This defines the necessary autoloads. Now, visit a file containing an XML document, and do the following: M-x nxml-mode Now do C-h m For information on how to use nxml-mode. The beginnings of a manual are in nxml-mode.info. You can read this using: C-u M-x info RET nxml-mode.info RET It's also installed as an entry at the end of the top-level info directory. So you can read it with C-h i as usual. You can use test.valid.xml and test.invalid.xml as examples of valid and invalid XML documents. To get things automatically loaded each time you start Emacs, add: (load "~/nxml-mode-200YMMDD/rng-auto.el") to your .emacs, where ~/nxml-mode-200YMMDD is the directory containing the .elc files. Note that rng-auto.el does not load all of the nxml-mode code; it merely sets things up so that all the features of nxml-mode will be autoloaded properly. You should not try to autoload rng-auto.el itself. To use nxml-mode automatically for files with an extension of xml, xsl, rng or xhtml, add the following to your .emacs file: (setq auto-mode-alist (cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode) auto-mode-alist)) If you edit XML using iso-8859-N encodings other than iso-8859-1 and you are running Emacs 21.3 or later, then I recommend enabling unify-8859-on-decoding-mode, by adding the following to your .emacs file: (unify-8859-on-decoding-mode) To get validation and schema-sensitive editing, you need a RELAX NG Compact Syntax (RNC) schema for you document. The schema directory includes some schemas for popular document types. For more on RELAX NG, refer to http://relaxng.org/. For a tutorial on RELAX NG Compact Syntax, refer to http://relaxng.org/compact-tutorial.html For automatically creating RNC schemas, I recommend my Trang program: http://eee.thaiopensource.com/relaxng/trang.html" You can use this to Infer an RNC schema from an instance document Convert a DTD to an RNC schema Convert a RELAX NG XML syntax schema to an RNC schema To convert a RELAX NG XML syntax (.rng) schema to a RNC schema, you can also use the XSLT stylesheet from http://www.pantor.com/download.html". To convert a W3C XML Schema to an RNC schema, you need first to convert it to RELAX NG XML syntax using Sun's RELAX NG converter tool rngconv (built on top of MSV). Refer to https://www.dev.java.net/. The file NEWS describes recent changes. Please use the list http://groups.yahoo.com/group/emacs-nxml-mode for bug reports, discussion. I will announce all new versions there. James Clark jjc@thaiopensource.com