]>
A template for a typical 'xdoc' can be found in this
section
of the main Maven site, we'll just discuss a few additions here.
The xdoc plugin will produce
will produce:
From version
An anchor is constructed from each
In previous versions of the plugin, an
We recommend that you provide an
If you need to include the contents of another XML document in your
document, you can use the
would produce the following output (click
here to see the content of
Note that it is possible to validate the included
xml file with the
You can put a navigation bar on bottom of each page by including a
This element should appear after the last
Due to a bug in Jelly, it is not possible to use custom entities directly in xdoc documents.
A workaround has been implemented such that you need to embed your entities
in
where the file
which can then be used in your xdoc like:
<h2> and
<h3> headings for <section>
and <subsection> elements, respectively.
It is therefore perfectly valid to put some sub-headings
(<h4>, <h5>,
<h6>) inside a subsection. For instance,
A subsubsection
1.10 on, the xdoc plugin
allows for an optional id attribute in the
section and subsection elements:
id attribute, so you can
reference sections and subsections from other source documents.
Note that each id attribute has to be unique within one
source document.
id attribute was
constructed from section/subsection names, replacing special
characters by underscores. For backwards compatibility reasons,
we keep this behaviour, i.e., if no id attribute
is present, an anchor is constructed from the name attribute.
Note that this presents two shortcomings:
id attribute if you want
to reference a section or subsection.
<escapeXml> tag,
as demonstrated below. For instance, the code:
escapeXml.xml):
xdoc:validate goal even if it is not
a valid xdoc document (like in the example above). You just have to
provide a custom .dtd or .xsd schema file
with the same base name in the same directory. Otherwise,
you should use the maven.xdoc.validate.exclude
property to exclude specific files from validation.
<navbar/> element in an xdoc's body.
This element takes three optional attributes,
prev, home and next:
<section/> of the document.
Check the bottom of this page for an example.
<entity> tags. First you should declare the resource file
for your entities:
entities.ent contains, eg:
Note that xdoc files using entities in this way
cannot be validated with the xdoc:validate goal
(see below).
The xdoc:validate goal can be used to check whether your
source files are valid xdoc documents. This should ensure that the
generated html files are valid
XHTML1-transitional.
To support validation of your xdoc source files by an external tool,
you should include the following DOCTYPE
declaration just after the <xml> element:
Here is a list of common mistakes to be aware of:
Wrong:
Correct:
of things to do.
]]>
Typical block level elements are list elements,
<table>, <source>,
<div>, <p> and
<pre>.
Wrong:
Correct:
Typical inline elements are
<a>, <strong>,
<code>, <font>,
<br> and <img>.
The <title> element has to come before
<author>.
Wrong:
Correct:
However, you may put <source> elements inside
list items or table rows.