nXML mode

nXML mode is an addon for GNU Emacs, which makes GNU Emacs into a powerful XML editor. It's called nXML mode because in Emacs terminology addons that customize Emacs for editing text of a particular sort are called modes. Emacs already has a simple mode for XML; nXML mode is a new mode for XML.

You should realize that Emacs with nXML mode differs from most XML editors in that XML is edited as text. What you see while you are editing is similar to what you would see if you were using a non-XML aware text editor. nXML mode does not attempt to conceal the XML tags. The big advantage is that you do not lose any functionality in moving from a text editor to nXML mode. All normal text editing commands can be used with nXML mode without restriction. nXML mode does not require that the XML document always be valid or even well-formed.

nXML mode allows a schema to be associated with the XML document being edited. The schema is used to provide two key features:

nXML mode uses Relax NG as its schema language. Relax NG has two alternative syntaxes: an XML syntax and a more readable, non-XML compact syntax. nXML mode supports the compact syntax. There are tools available to translate from DTDs and other schema languages into Relax NG compact syntax. Schemas for DocBook, XHTML, XSLT, RDF and RELAX NG are included in the nXML mode download.

nXML mode can also be used without any schema. Features that work without any schema include support for inserting end-tags easily.

nXML mode is implemented entirely in Emacs Lisp (Emacs' builtin extension language). This allows nXML mode to work on any platform that Emacs supports, without any modifications to Emacs. It consists of approximately 17,000 lines of Emacs Lisp.


GNU Emacs version 21.x is required, preferably 21.3. Emacs 20 will not work, nor will XEmacs.


nXML mode can be downloaded from http://www.thaiopensource.com/download/. Look for a file with a name of the form nxml-mode-YYYYMMDD.tar.gz. After downloading, extract the files from the .tar.gz archive and read the README file for how to get started.

Mailing list

Further information about nXML mode

Information about Relax NG


Related software

James Clark

Last updated: 2004-10-14