dtd2ini:  Convert DTDs to Content-Model .ini Files

About dtd2ini
-------------
dtd2ini reads XML DTDs and generates .ini files that can be used
by other programs to work with the content models described in the
DTDs.  The default settings in dtd2ini.ini are intended for use with 
Mif2Go.  Many additional options are provided to make dtd2ini usable 
with other programs.

dtd2ini is based on the validating XML parser RXP.  We wish to thank
Richard Tobin, the author of RXP, for creating that parser, and for 
his kind advice during development of dtd2ini.

RXP is open source, licensed under the GPL v.2, and therefore dtd2ini
is also open source under the same license.  Both the current Windows
executable and the full C source are available on Omni Systems' web
site, and are freely downloadable without any obligation, from:
  http://www.omsys.com/dcl/download.htm

Usage
-----
Run dtd2ini from the command line, in the directory where you want
the output.  dtd2ini reqires two arguments, with an optional third 
argument:

  dtd2ini  source.dtd  output.ini  dtd2ini.ini

source.dtd 
Can include a relative or absolute path to the DTD to be read.  
It can also be a URL, if the system on which dtd2ini is being run 
allows connection to the Internet.  It is always converted to a 
full URI, such as "file:///c:/dtd/model.dtd", per IETF RFC 2396.
If it already a URI starting with file://, http://, or ftp://, 
it is used as-is.

output.ini 
Contains the content model generated by dtd2ini.  If a file of 
the same name already exists in the same location, that file is 
overwritten without a warning.

dtd2ini.ini 
Controls how the output is produced.  If you omit this argument,
dtd2ini uses configuration file dtd2ini.ini.  However, if you have 
renamed dtd2ini.exe to othername.exe, othername.exe also checks 
othername.ini.  In either case, if you omit the third argument, 
an .ini file named for the dtd2ini program must be present.  

Sample .ini files for dtd2ini
-----------------------------
Two sample dtd2ini-controlling .ini files are included in this 
archive:

dtd2ditatopic.ini - for a DITA specialization
dtd2docbook.ini - for a DocBook DTD

Pick the one closest to what you want (DITA or other), edit it, and 
save as dtd2ini.ini (or whatever other name you want to use as the
third command-line argument).

Annotated description of the controlling .ini file
======================================================================
; dtd2ini.ini is the initialization file for the DTD to ini converter.
; This version is for dtd2ini.exe version 0.1 build 002.
; Licensed under the General Public License (GPL), Version 2.

[Options]
; OutputType = XML (default, for general XML use) or DITA (excludes
; TopicBody element from [TopicParents], makes other adjustments)
OutputType=XML
; AlphaSort = Yes (default, sort element names) or No (leave in
; parent/child order found during traversal of DTD tree from root)
AlphaSort=Yes

; TopicParents = Yes (default, produce [TopicParents] section) or No
TopicParents=Yes
; TopicLevels = Yes (default, produce [TopicLevels] section) or No
TopicLevels=Yes
; TopicFirst = Yes (default, produce [TopicFirst] section) or No
TopicFirst=Yes
; TopicChildren = No (default) or Yes (produce [TopicChildren] section
TopicChildren=No
;
; ElementTypes = Yes (default, produce [ElementTypes] section) or No
ElementTypes=Yes
; ShowVotes = No (default) or Yes (show the number of inline and block 
; votes for each element in ElementType)
ShowVotes=No
; BlockWeighting = Multiplier for block votes in determining ElementType
BlockWeighting=10
;
; ElementSets = Yes (default, produce [ElementSets] section) or No
ElementSets=Yes
; A "part" is an automatically generated set of elements:
; MinimumPartSize = Minimum number of matching elements for a part
MinimumPartSize=4
; MaximumPartSize = Maximum number of elements for a single part
MaximumPartSize=20


[Topic]
; ModelName = name to use for DITA content model; if it matches
; an existing name, this model replaces the existing one.
ModelName=concept
;
; TopicRoot = root element to use when generating content model.
; Note that the same DTD, with different roots specified, can 
; produce very different content models.  This setting is required.
TopicRoot=book
;
; Settings for specially-processed topic elements, used for DITA
TopicStart=title
TopicBody=conbody
;
; Settings for PUBLIC and SYSTEM identifiers, for DITA and DocBook
PrologDType="-//OASIS//DTD DITA Concept//EN"
PrologDTD=  "http://docs.oasis-open.org/dita/v1.1/CD01/dtd/concept.dtd"


[ElementTypes]
; Overrides to be included in DocBook*.ini or DITA*.ini, to correct
; for failures of the heueristic block/inline voting method, and
; to specify preformatted elements.  The recognized terms are Block,
; Inline, and Preform.  The generated .ini may also contain Text,
; but that is set exclusively from the DTD and cannot be overridden.

; Default element types for DocBook:
para=Block Text
phrase=Inline Text

; DITA preformatted elements:
codeblock=Preform
lines=Preform
msgblock=Preform
pre=Preform
screen=Preform

; DocBook preformatted elements:
literallayout=Preform
programlisting=Preform
screen=Preform
synopsis=Preform


[AddedSections]
; Increment = name of added section.  Adds any sections listed
; below to the end of the output .ini, such as DITA table sections,
; which are needed by Mif2Go but are not produced by dtd2ini
; (because the data required are not in the DTD).  Number the
; entries for added sections sequentially:
1=TopicTables
2=SimpleTable
3=PropertyTable

; The added sections themselves go here


[End]
; end of dtd2ini.ini

=====================================================================

Copyright (c) 2008 by Jeremy H. Griffith.  All rights reserved.
Licensed under the General Public License, Version 2.0.


