A posting from James Clark announces the availability of a DTD converter 'DTDinst' which converts XML DTDs into XML instance format. "The XML instance can be in either a format specific to DTDinst or can be in RELAX NG format." The DTDinst-specific output format is documented in RELAX NG non-XML syntax and in RELAX NG format. The key feature of DTDinst "is its handling of parameter entities: it is able to reliably turn parameter entity declarations and references into a variety of higher-level semantic constructs. It can do this even in the presence of arbitrarily deep nesting of parameter entity references within parameter entity declarations. At the same time, it accurately follows XML 1.0 rules on parameter entity expansion, so that any valid XML 1.0 DTD can be handled. If a parameter entity is used in a way that does not correspond to any of the higher-level semantics constructs supported by DTDinst, then references to that parameter entity will be expanded in the DTDinst output. DTDinst is available as a precompiled JAR file; the source is also available." Clark provides an XSLT stylesheet that "converts DTDinst format to RELAX NG; it has many more limitations than the converter builtin to DTDinst, but it may be useful as a basis for XSLT-based processing of DTDinst format." James writes: "Feedback is welcome, especially on any DTDs it doesn't handle well and on additional features that you would like to see..."
Some limitations: "DTDinst does not attempt to understand the contents of ignored conditional sections: DTDinst format represents the contents of an ignored section as a string. If you wish to preserve information about conditional sections, you should therefore make as many conditional sections as possible be included marked sections rather than ignored marked sections. You can do this by creating a wrapper DTD that declares parameter entities as INCLUDE and then references the real DTD. For example, you might use this wrapper DTD to convert the TEI P4 DTD. DTDinst does not attempt to understand the contents of parameter entities that are never referenced. The conversion to RELAX NG preserves neither conditional sections nor overridden parameter entity declarations. If you need to preserve these, the recommended approach is to generate RELAX NG from DTDinst format using a transformation (perhaps written in XSLT) customized for for your particular DTD."