| home / experts / xml / column68 |
|
In this last installment of our mini-series on documenting DTDs we finish our dtddoc tool
by generating the HTML pages out of the parsed DTD and its annotations.
This is the fourth and final step in its creation:
Now that we have collected all the available information from a DTD and found a suitable format for annotating it, our last task is to pour that content into a nice format. Registering my project on SourceForge I realized there is already a DTDDoc project. Shame on me for not looking there in the first place, but examining the output of that software reveals similar weaknesses to the already introduced dtd2html:
Comparing all the strengths and weaknesses of the existing solutions I ended up with the following page structure:
Frames are not used as in javadoc, because a DTD
is roughly equivalent to one Java package, and the frame navigation is only really useful for navigating
across many packages at the same time. DTDs are not interrelated in the same way, something that
might change with XML Schema and RELAX NG.
I want to spare you all the gory coding details, they are available as source code listings in the various language sections below. The whole package for all three languages is also available.
The Java solution delegates the generation of the various pages to a specialized method, passing
along a java.io.Writer object for the respective output file. Navigating the in-memory
data structure for DTD elements proved to be cumbersome for our purposes, so I reverted to the
ORO regular expression matching for processing an element's content model. Every element name is
augmented with a hyperlink to its respective detail page. You can
inspect the source code.
Produced by Michael Claßen
URL: http://www.webreference.com/xml/column68/index.html
Created: Nov 11, 2002
Revised: Nov 11, 2002