Re: [xml-dev] SGML default attributes.

From
John Cowan <>
To
Norman Gray <>
Date
2016-04-29T16:58:11Z
ID
<>
Thread
Re: [xml-dev] SGML default attributes.

On Fri, Apr 29, 2016 at 8:54 AM, Norman Gray <[email protected]> wrote:

In the XML world, the DTD is just for validation

That turns out not to be the case.  There are a number of XML DTD features which affect the infoset returned by a compliant parser.  If they are in the internal subset, the parser MUST respect them; if they are in the external subset, then any parser that reads the external subset likewise MUST respect them.

Long ago I wrote a Java program called dtdcrunch <http://home.ccil.org/~cowan/dtdcrunch.zip> that takes an arbitrary DTD external subset and reduces it to just what is meaningful to non-validating parsers.  In particular, default attribute values are preserved, as is any attribute declaration for a type other than CDATA.  Entity declarations are also kept, and simplified element declarations of the form <!ELEMENT foo (foo)> are created for all elements whose content model consists only of child elements, and in which whitespace is ignorable.


--
John Cowan          http://www.ccil.org/~cowan        [email protected]
Business before pleasure, if not too bloomering long before.
        --Nicholas van Rijn