Re: [xml-dev] How to flatten a DTD to one file

From
Chris Maloney <>
To
John Cowan <>
Date
2015-07-14T19:33:46Z
ID
<>
Thread
Re: [xml-dev] How to flatten a DTD to one file
With Jeff Beck's help on the XSLT, I went ahead and implemented this in our DtdAnalyzer. For the record, in case anyone else is interested, it is here: http://dtd.nlm.nih.gov/ncbi/dtdanalyzer/. The new utility is called "dtdflatten".

One known limitation is that it does not preserve any NOTATION declarations.

John, I had a look at your DTDCrunch, and yes, I think that's more than we want -- I definitely want to preserve the ability to validate against the flattened DTD.  Also, it looks like maybe you have an escaping problem.  In xhtml1-crunched.dtd, you have
    <!ENTITY quot """ >
You need to escape the quote mark.  We ran into this same problem in our first iteration.

Cheers!
Chris Maloney

On Tue, Jul 14, 2015 at 10:04 AM, John Cowan <[email protected]> wrote:
Scripsit Chris Maloney:

> Yes, I just did, without luck. Trying to flatten NLM DTD journal publishing
> 3.0, it hung on `Element mml:none`. I poked around a little bit in the perl
> code, but couldn't figure it out.

My DTDCrunch might do more than you want: it crunches a (potentially multi-file)
DTD into the minimal information required by a non-validating parser.  Entity
declarations are preserved; attribute declarations are preserved unless they are
of type CDATA and have no default value; element declarations are preserved only
if the element has element-only content, and then in the trivial form
<!ELEMENT foo (foo)>.  There is one declaration per output line.

--
John Cowan          http://www.ccil.org/~cowan        [email protected]
                .e'osai ko sarji la lojban.
                Please support Lojban!          http://www.lojban.org