XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] How to flatten a DTD to one file

Another option to flatten DTDs is a simple Perl script using libxml. My colleague sent me an example, and I polished it up a little and put it here: https://github.com/ncbi/DtdAnalyzer/blob/master/script/dtdflatten.pl

Cheers!


On Tue, Jul 14, 2015 at 3:33 PM, Chris Maloney <voldrani@gmail.com> wrote:
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 <cowan@ccil.org> 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        cowan@ccil.org
                .e'osai ko sarji la lojban.
                Please support Lojban!          http://www.lojban.org






[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS