Re: Edit xml files with Emacs for Docbook

"Peter Flynn [email protected] [emacs-nxml-mode]" <[email protected]> Thu, 14 Apr 2016 22:44:10 +0100
Newsgroups gmane.emacs.nxml.general
Organization Silmaril Consultants
Message-ID <[email protected]>
On 04/14/2016 10:49 AM, Markos [email protected] [emacs-nxml-mode] wrote:
> Without abuse your goodwill, could you suggest any text, for beginner,
> for me to understand a little about these modes: xml, nxml, SGML, etc

I maintain the XML FAQ at http://xml.silmaril.ie which might be a start.

Or read the TEI's "Gentle Introduction to XML" chapter at
http://www.tei-c.org/release/doc/tei-p5-doc/en/html/SG.html

> and how Emacs handles these technologies.

That's a different thing altogether. Emacs is an editor that can edit
almost anything.

Nice people have written plugins called "modes" to let Emacs handle
different file formats.

[WARNING: the following is a personal view: others may disagree]

The original sgml-mode wasn't much use: it recognised pointy brackets
but that was about it.

Parsing sgml mode (psgml-mode) was a huge improvement: it could read a
DTD (the format description of an SGML/XML vocabulary) so it understood
the document structure and could perform name completion, and it
provided proper editing keystrokes like insert-element, remove-element,
surround-with-element, delete-element, edit-attributes, go-to-start-tag,
go-to-end-tag, etc. If your files rely on DTDs, then this is the editing
mode to use.

But XML can also work with W3C Schemas instead of DTDs. These are
heavily used, and nxml-mode is an editing mode for Emacs that understand
them. Unfortunately (IMHO) it doesn't provide much in the way of an
editing interface, certainly nowhere near as much as psgml provided. Bt
it does handle Schemas, so if you prefer or are constrained to work with
Schemas, nxml-mode is what you want.

Current versions of Emacs come with nxml-mode enabled by default (only).
To use psgml-mode you first need to install it, and then configure it,
and then (as I mentioned in an earlier post) find a way to defeat
nxml-mode from usurping the editing posture when you open an XML document.

> I even thought about studying Lisp to better use the resources of Emacs.

I have wanted to do that for a couple of decades and haven't got around
to it yet :-)

> Even if I can't implement changes in Emacs I would like to use this
> opportunity to learn a bit more about these issues.

Welcome aboard.

///Peter


------------------------------------
Posted by: Peter Flynn <[email protected]>
------------------------------------