A DTD Normalizer

Bob DuCharme
March 24, 2003

"We are normal and we want our freedom."
- Bonzo Dog Band

The dtdnorm.py script uses Lars Marius Garshol's xmlproc Python XML parser to resolve all the parameter entity references in a DTD. (Lars wrote dtdnorm.py and gave me permission to post it here. I added a few tweaks that are identified in the code.) dtdnorm.py is very handy for turning a collection of DTD files that reference each other into a single file that can replace the main one. No knowledge of Python is required to use it.

In addition to the dtdnorm.py script, you'll need xmlproc and a Python implementation. I'm using ActiveState's free Python, which you can get here.

After installing Python, get xmlproc from here. Unzip it into its own directory somewhere and put dtdnorm.py into the same directory. For me, the directory is called \dev\xmlproc, so by entering the following

  python \dev\xmlproc\dtdnorm.py

I display the directions for dtdnorm:


	 python dtdnorm.py  mainfile.dtd outfile.dtd

  to turn mainfile.dtd and all referenced external parameter
  entities into the single DTD file outfile.dtd. The xmlproc
  Python XML parser is required to run dtdnorm.