This section describes how dbdoclet and herold are mapping HTML tags to DocBook XML.
Mapping List HTML -> DocBook XML
aIf the attribute name is set, an anchor element is created. The attribute name becomes the attribute id in DocBook. The value of the id attribute starts with the prefix "dbdoclet.id.". The original value is transformed in a way that it meets the requirements of a DocBook id. It must start with a letter and any non word characters are replaced by the underscore. Because the id's must be unique, an optional number can follow the index name to ensure uniqueness.
Example 5.1. Example of mapping a to anchor
The HTML code
<a name="introduction" />
will be converted to DocBook XML
<anchor id="dbdoclet.id.introduction" />
If the attribute href starts with a "#" character, a link is created that points to the referenced spot in the content. If no spot with the appropiate name can be found a dummy spot is created at the beginning of the document.
Example 5.2. Example of mapping a to link
The HTML code
<a href="#introduction">the introduction</a>
will be converted to DocBook XML
<link linkend="dbdoclet.id.introduction"/>
If the value of the attribute href doesn't start with "#" an link is created.
Example 5.3. Example of mapping a to link
The HTML code
<a hef="http://www.dbdoclet.org">The dbdoclet homepage</a>
will be converted to DocBook XML
<link xl:href="http://www.dbdoclet.org">DBDoclet Home</link>
A special case is the apprearance of an img inside an a, because in DocBook the nesting is the other way round.
Example 5.4. Example of mapping a -> img to mediaobject -> link
The HTML code
<a href="http://www.dbdoclet.org"> <img src="image.gif" alt="Image"> </a>
will be converted to DocBook XML
<informalfigure> <mediaobject> <imageobject> <imagedata fileref="./image.gif" format="GIF"/> </imageobject> </mediaobject> <link xl:href="http://www.dbdoclet.org"></link> </informalfigure>
abbrThe tag abbr becomes the tag abbrev in DocBook.
Example 5.5. Example of mapping abbr to abbrev
The HTML code
<abbr>Mr.</abbr>
will be converted to DocBook XML
<abbrev>Mr.</abbrev>
acronymThe tag acronym becomes the tag acronym in DocBook.
Example 5.6. Example of mapping acronym to acronym
The HTML code
<acronym>SGML</acronym>
will be converted to DocBook XML
<acronym>SGML</acronym>
addressThe tag address becomes the tag address in DocBook.
Example 5.7. Example of mapping address to address
The HTML code
<address>Hofbräuhaus, München</address>
will be converted to DocBook XML
<address>Hofbräuhaus, München</address>
appletThe tag applet is ignored.
areaThe tag area is ignored.
bThe tag b becomes emphasis with the attribute role set to bold.
Example 5.8. Example of mapping b to emphasis
The HTML code
<b>Hippopotamomus</b>
will be converted to DocBook XML
<emphasis role="bold">Hippopotamomus</emphasis>
baseThe tag base is ignored.
basefontThe tag basefont is ignored.
bdoThe tag bdo is ignored.
bigThe tag big is ignored.
blockquoteThe tag blockquote becomes the tag blockquote in DocBook.
Example 5.9. Example of mapping blockquote to blockquote
The HTML code
<blockquote> Once upon a midnight dreary, while I pondered weak and weary, Over many a quaint and curious volume of forgotten lore, While I nodded, nearly napping, suddenly there came a tapping, As of some one gently rapping, rapping at my chamber door. `'Tis some visitor,' I muttered, `tapping at my chamber door - Only this, and nothing more.' </blockquote>
will be converted to DocBook XML
<blockquote> <para>Once upon a midnight dreary, while I pondered weak and weary, Over many a quaint and curious volume of forgotten lore, While I nodded, nearly napping, suddenly there came a tapping, As of some one gently rapping, rapping at my chamber door. `'Tis some visitor,' I muttered, `tapping at my chamber door - Only this, and nothing more.'<para> </blockquote>
bodyThe tag body is ignored.
brThe tag br becomes a new para, if the current element is also a para. Otherwise a simple newline is inserted into the output.
buttonThe tag button is ignored.
captionThe tag caption becomes the tag title in DocBook.
Example 5.10. Example of mapping caption to title
The HTML code
<caption>Caption</caption>
will be converted to DocBook XML
<title>Caption</title>
centerThe tag center is ignored.
citeThe tag cite is ignored.
codeThe tag code becomes one of the tags literal or programlistingin DocBook, depending on the model of the parent DocBook element. If it is of kind "Content Model" the tag programlisting is used, otherwise literal is used.
Example 5.11. Example of mapping code to literal
The HTML code
<code>public class Brain</code>
will be converted to DocBook XML
<literal>public class Brain</literal>
colThe tag col is ignored.
colgroupThe tag colgroup is ignored.
ddThe tag dd becomes listem - para in DocBook.
Example 5.12. Example of mapping dd to listitem
The HTML code
<dd>description</dd>
will be converted to DocBook XML
<listitem><para>description</para></listitem>
delThe tag del is ignored.
dfnThe tag dfn is ignored.
dirThe tag dir becomes itemizedlist in DocBook.
divThe tag div can be used for creating formal examples. If a div tag contains the attribute id with a value that starts with "example" (caseinsensitive) an example tag is created in the resulting DocBook code. Furthermore, if the attribute title is present, a formal example with a title is created, otherwise an informal one. The following paragraph shows an example.
Example 5.13. Example for the DocBook tag example
<div id="example_class_service"
title="Example for the class service"> <pre> public class
Service { private String name; . . . } </pre> </div>
The tag div can also be used for creating the DocBook tags Caution, Important, Note, Tip and Warning. If a div tag contains the attribute id with a value that starts with one of the name of these tags (caseinsensitive) an appropriate tag is created in the resulting DocBook code. Furthermore, if the attribute title is present, a formal tag with a title is created, otherwise an informal one. The following paragraph shows an example.
Example 5.14. Example for the DocBook tag tip
<div id="tip_class_service" title="Use DocBook Doclet"> <p>Use the DocBook Doclet for generating reference handbooks out of your javadoc comments.</p> </div>
dlThe tag dl becomes variablelist in DocBook.
If the list is a nested list, the surrounding listitem tag is created automatically.
dtThe tag dt becomes varlistentry - term in DocBook.
Example 5.15. Example of mapping dt to varlistentry
The HTML code
<dt>Term</dt><dd>Description</dd>
will be converted to DocBook XML
<varlistentry> <term>Term</term> <listitem><para>description</para></listitem> </varlistentry>
emThe tag em becomes emphasis in DocBook.
fieldsetThe tag fieldset is ignored.
fontThe tag font is ignored.
formThe tag form is ignored.
framesetThe tag frameset is ignored.
h1-6The header tags of HTML are transformed to sect1-5 and bridgehead DocBook tags. The concrete mapping depends on the context in the created DocBook tree. dbdoclet keeps the nesting of section in the correct order, even if the nesting in the HTML source is somewhat strange.
headThe tag head is ignored.
hrThe tag hr is ignored.
htmlThe tag html is ignored.
iThe tag i becomes emphasis in DocBook.
iframeThe tag iframe is ignored.
imgThe tag img becomes InlineMediaObject, if the DocBook parent element is one of Emphasis, Entry, Screen, Term or Link. Otherwise it becomes MediaObject.
inputThe tag input is ignored.
insThe tag ins is ignored.
isindexThe tag isindex is ignored.
kbdThe tag kbd is ignored.
labelThe tag label is ignored.
legendThe tag legend is ignored.
liThe tag li becomes listem - para in DocBook.
Example 5.16. Example of mapping li to listitem
The HTML code
<li>description</li>
will be converted to DocBook XML
<listitem><para>description</para></listitem>
linkThe tag link is ignored.
mapThe tag map is ignored.
menuThe tag menu becomes itemizedlist in DocBook.
metaThe tag meta is ignored.
noframesThe tag noframes is ignored.
noscriptThe tag noscript is ignored.
objectThe tag object is ignored.
olThe tag ol becomes orderedlist in DocBook.
If the list is a nested list, the surrounding listitem tag is created automatically.
optgroupThe tag optgroup is ignored.
optionThe tag option is ignored.
pThe tag p becomes para in DocBook.
paramThe tag param is ignored.
preThe tag pre becomes literal if the DocBook parent is entry, programlisting if the DocBook parent is Example or InformalExample. In all other cases pre becomes screen.
qThe tag q is ignored.
sThe tag s is ignored.
sampThe tag samp is ignored.
scriptThe tag script is ignored.
selectThe tag select is ignored.
smallThe tag small is ignored.
spanThe tag span can be used to insert index entries in the html code. Use the follwoing syntax to create an indexterm entry:
<span title="indexterm:primary=Animals:secondary=Tiger">Tiger</span>
The preceding code will result in the following DocBook XML:
<indexterm> <primary>Animals</primary> <secondary>Tiger</secondary> </indexterm>
strikeThe tag strike is ignored.
strongThe tag strong becomes emphasis with the attribute role set to bold.
Example 5.17. Example of mapping strong to emphasis
The HTML code
<strong>Hippopotamomus</strong>
will be converted to DocBook XML
<emphasis role="bold">Hippopotamomus</emphasis>
styleThe tag style is ignored.
subThe tag sub becomes subscript in DocBook.
supThe tag sup becomes superscript in DocBook.
tableThe tag table becomes entrytbl, table or informaltable in DocBook.
If the current DocBook parent is row or entry the a nested entrytbl is created.
If the HTML tag table has a child element caption a DocBook table created. Otherwise an informaltable is created.
tbodyThe tag tbody becomes tbody in DocBook.
tdThe tag td becomes entry - para in DocBook.
Example 5.18. Example of mapping td to entry
The HTML code
<td>description</td>
will be converted to DocBook XML
<entry><para>description</para></entry>
textareaThe tag textarea is ignored.
tfootThe tag tfoot becomes tfoot in DocBook.
thThe tag th becomes entry - para - emphasis in DocBook.
Example 5.19. Example of mapping th to entry
The HTML code
<th>table column header</th>
will be converted to DocBook XML
<entry><para><emphasis role="bold">table column header</emphasis></para> </entry>
theadThe tag thead becomes thead in DocBook.
titleThe tag title is ignored.
trThe tag tr becomes row in DocBook.
ttThe tag tt becomes literal in DocBook.
uThe tag u becomes emphasis with the attribute role set to underline.
Example 5.20. Example of mapping u to emphasis
The HTML code
<u>Hippopotamomus</u>
will be converted to DocBook XML
<emphasis role="underline">Hippopotamomus</emphasis>
ulThe tag ul becomes itemizedlist in DocBook.
If the list is a nested list, the surrounding listitem tag is created automatically.
varThe tag var becomes programlisting if the tag is inside a blockquote, otherwise it becomes a literal tag.