Since XMLDOCS is based on DocBook XML, the usual DocBook XML rules apply: XML markup consists of XML "tags" (same style as HTML tags), but all of which must be opened (and closed — you cannot omit the closing tag) respecting the hierarchy of tags within a document. In addition, attributes must always be quoted. These two rules are non-negotiable with DocBook XML. Here's an example:
<?xml version="1.0" standalone="no"?> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook-Interchange XML V4.2//EN" "../docbook/docbookxi.dtd"> <article id='xmldocs'> <sect1> <title>Test title</title> <para> <!-- COMMENT: Beginning of a paragraph --> It is <emphasis>very</emphasis> important to read this line. Some lines are <emphasis role='bold'>boldly bolder</emphasis> than others. The <database>products</database> database contains products. </para> </sect1> </article>
As you can see, XML can look structured and all, but there's so much overhead involved in writing XML documentation. For example, I wouldn't know offhand how to define DOCTYPE properly — I just took the effort of learning it once, and I kept copy/pasting it ever since.
XMLDOCS aims to be as overhead-free and efficient as possible to write. This, however, leads us to mention four main differences between DocBook XML and XMLDOCS:
A lot of XMLDOCS markup and content is autogenerated. For example, all Interchange source code shown is taken out of CVS, and is therefore always up to date. The same goes for information such as say, file version numbers and modification times.
Instead of writing complete XML documents (those that contain XML
"head and tail" and would be valid if taken standalone), in XMLDOCS
you only need to
provide short blocks of input to predefined "slots". These slots
already provide all needed XML wrapping, so you can get onto writing
actual text right away. For example, the opening
<para>
and the closing
</para>
are always part of the template, so
you can (and in fact, must) omit them when filling in the
documentation slots.
DocBook XML supports "entities". Entities are something like variables
and are inserted using
syntax.
XMLDOCS contain a ton of predefined Interchange-suitable entities, to both
reduce typing
and to "formalize" the look and feel. Compare the clarity and convenience
of the below examples:
&NAME;
<!-- Generic DocBook XML way: --> Please see the <olink targetdoc='confs' targetptr='Catalog'><option>Catalog</option></olink> configuration directive. <!-- XMLDOCS way: --> Please see the &conf-Catalog; configuration directive. <!-- Or, another example: --> Add the following to your <filename>catalog.cfg</filename>: Add the following to your &ccf;:
In XMLDOCS, we use a controlled set of XML tags, plus few Interchange-specific ones. For example, all Perl functions are marked up using DocBook XML's <function>, while all "mv" variables are marked up using our custom <mv> tag.