Emacs will perform syntax highlighting and indent correctly on DocBook XML files if you provide it with the proper Document Type Declarations (DTD) file. These two features will make your XML file look pretty and help you spot errors.
To create a loadable Parsed DTD file:
Find the parent file for the group of DocBook files. You will
recognize this file by the header <!DOCTYPE article
PUBLIC "-//OASIS//DTD DocBook V4.1//EN"
. An easy way
to find this parent file is to use the command grep
DocBook *.xml
. Once you find the parent file, open it
in Emacs with the command emacs
(where
<parentfile>
.xml<parentfile>
.xml is the parent
file you found.
Choose DTD -> Parse DTD
from the pulldown
menu.
You will know the parsing is finished when you see the message
Fontifying...done
at the bottom
of your screen. Save the parsed DTD to a file by choosing
DTD -> Save Parsed DTD
from the pulldown menu.
Press Enter to save the file to the default
filename or rename the file keeping the .ced
extension. It can be useful to name it something generic such as
docbook.ced
so you can refer to it when
opening all DocBook files. This file can also be copied from
directory to directory to be loaded.
Tip | |
---|---|
You can also use the Emacs command |