[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to flatten a DTD to one file

  • From: Chris Maloney <voldrani@gmail.com>
  • To: John Cowan <cowan@ccil.org>
  • Date: Mon, 20 Jul 2015 16:43:44 -0400

Re:  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@c...> 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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.