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

  M-x load-file <RET> rng-auto.el <RET>

This defines the necessary autoloads.  Now, visit a file containing
an XML document, and do

  M-x nxml-mode

Now do

  C-h m

for information on how to use nxml-mode.

See the file TUTORIAL for some additional notes on how to use
nxml-mode.

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-YYYYMMDD/rng-auto.el")

to you .emacs, where ~/nxml-mode-YYYYMMDD is the directory containing
the .elc files.

To use nxml-mode automatically for files with an extension of xml,
xsl, rng or xhtml, add

  (setq auto-mode-alist
        (cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode)
	      auto-mode-alist))

to your .emacs.

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, see

  http://relaxng.org

For a tutorial on RELAX NG Compact Syntax, see

  http://relaxng.org/compact-tutorial.html

For automatically creating RNC schemas, I recommend my Trang program:

  http://www.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). See

  https://msv.dev.java.net/

There are some limitations you should be aware of:

- DTD support is limited.  Internal parsed general entities declared
in the internal subset are supported provided they do not contain
elements. Other usage of DTDs is ignored.

- The restrictions on RELAX NG schemas in section 7 of the RELAX NG
specification are not enforced.

- Unicode support has problems. This stems mostly from the fact that
the XML (and RELAX NG) character model is based squarely on Unicode,
whereas the Emacs character model is not.  There's apparently a
Unicode version of GNU Emacs in development, which I hope will improve
the situation here.

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
