NAME
dtd2db - Generate a DocBook documentation from a DTD
SYNOPSIS
dtd2db [-d] [-C | -M] [-HZ] [-o filename] [-t title] [-x 'example1.xml example2.xml ...'] [-l language | -p path] file.xml
OPTIONS
- -C
-
Suppress all comments.
- -D
-
Suppress date generation.
- -d
-
Generate a clean DTD (without comment).
- -H
-
Disable generation of links in comments.
- -h
-
Display help.
- -l
-
Specify the language of templates ('en' is the default).
- -M
-
Suppress multi comments, preserve the last.
- -o
-
Specify the output.
- -p
-
Specify the path of templates.
- -t
-
Specify the title of the DocBook files.
- -v
-
Display Version.
- -x
-
Include a list of XML files as examples.
- -Z
-
Delete zombi element (e.g. without parent).
DESCRIPTION
dtd2db is a front-end for XML::Handler::Dtd2DocBook and its subclasses. It uses them to generate XML DocBook documentation from DTD source.
Because it uses XML::Parser and an external DTD is not a valid XML document, the input source must be an XML document with an internal DTD or an XML document that refers to an external DTD.
The goal of this tool is to increase the level of documentation in DTD and to supply a more readable format for DTD.
It is a tool for DTD users, not for writer.
All comments before a declaration are captured.
All entity references inside attribute values are expanded.
This tool needs XML::SAX::Base, XML::SAX::Exception, XML::SAX::Expat, XML::Parser, HTML::Template modules and XML::Handler::Dtd2Html.
Comments
XML files (and DTD) can include comments. The XML syntax is :
<!-- comments -->
All comments before a declaration are captured (except with -M option). Each comment generates its own paragraph <para>.
dtd2db Tags
dtd2db parses tags that are recognized when they are embedded within an XML comment. These doc tags enable you to autogenerate a complete, well-formatted document from your XML source. The tags start with an @. A tag with two @ forces a link generation if the option -H is set.
Tags must start at the beginning of a line.
The special tag @BRIEF puts its value in 'Name' section.
The special tag @INCLUDE allows inclusion of the content of an external file.
<!--
comments
@Version : 1.0
@INCLUDE : description.txt
@@See Also : REC-xml
-->
The special tag @HIDDEN don't put the data in the documentation.
The special tag @TITLE before <!DOCTYPE> has the same effect as the option -t.
The special tag @SAMPLE allows inclusion of a XML fragment from an external file.
<!--
comments
@SAMPLE ex2 : ex2.xml
-->
The special tags are case insensitive.
generated files
dtd2db generates a collection of files. Two files need attention.
- filename.xml
-
This is the DocBook entry point. It could be use as example for your own need :
- filename.custom.ent
-
This file concentrates all textual descriptions as entities. These entities are initialized by DTD comments if exists.
But this file could be manually modified after generation.
So unlike with dtd2html, adding comments directly in the DTD is not mandatory.
DocBook transformations
These transformation needs :
- DocBook XML DTD 4.2
-
<http://www.oasis-open.org/docbook/xml/>
- DocBook XSL Stylesheets
-
<http://docbook.sourceforge.net/projects/xsl/>
- xsltproc
-
<http://xmlsoft.org/XSLT/>
- FOP
-
< http://xml.apache.org/fop/>
For example :
dtd2db.pl -o ppd -x sample.ppd entry.ppd
xsltproc -o ppd.html --novalid \some-where\docbook-xsl\xhtml\docbook.xsl ppd.xml
xsltproc --novalid \some-where\docbook-xsl\xhtml\chunk.xsl ppd.xml
xsltproc --novalid \some-where\docbook-xsl\htmlhelp\htmlhelp.xsl ppd.xml
hhc htmlhelp.hhp
xsltproc -o ppd.fo --novalid \some-where\docbook-xsl\fo\docbook.xsl ppd.xml
fop -fo ppd.fo -pdf ppd.pdf
HTML Templates
XML design and Perl programming are decoupling. And a language switch option is available.
So, translation of the templates are welcome.
SEE ALSO
XML::Handler::Dtd2Html , dtd2html
AUTHOR
Francois PERRAD, francois.perrad@gadz.org
COPYRIGHT
(c) 2003 Francois PERRAD, France. All rights reserved.
This program is distributed under the Artistic License.