how do I get emacs nXML to work with Erlang documentation? (with answer)
I have answers, but maybe someone can improve on them.
I want emacs to "behave" when editing xml from the OTP repo, e.g.
emacs tells me "Using scheme /usr/share/emacs/24.5/etc/schema/docbook.rnc
and isn't happy with the document. <header>, <p> and <list> are
naughty. (actually, it's the nXML mode, which is the default
mode for editing XML in recent emacs versions.).
Q1: What is this .rnc file emacs is looking at?
A1: .rnc and .dtd are both ways of defining what an XML document can
look like, with overlapping capabilities. You can automatically
convert one into the other, probably losing some information.
Wild speculation: someone felt embarassed that XML .dtds aren't
XML themselves, which might cause the plebs to think that the
empreror has no clothes. So someone invented a new format 'Relax'
which did more or less what DTDs do, in XML. But 'relax' was
embarassingly verbose. Someone else then invented yet another
format which was actually readable. The two inventors couldn't
agree on which syntax to keep, so a committee stepped in to be
decisive...and chose both.
Q2: Why isn't emacs looking at the .dtd?
A2: No idea. The .dtd can be converted to a .rnc automatically, so
nXML could do that on the fly. Maybe the nXML author wants to
hasten .dtd's death.
Q3: I just want to edit the file without seeing errors. How?
A3: M-x rnc-set-vacuous-schema
Now nXML will just check for well-formedness (e.g. your tags match up).
You can also do that from the XML menu.
Q4: I want to get nXML to check more than just well-formedness. How?
A4: Convert the .dtd into .rnc and tell nXML to use it. Here's one way: