Gavin Nicol <[log in to unmask]> wrote:
> The only real way to compare DTD's is by comparing the content models
> of each. Ideally, you should be able to take the 2.0 DTD, and the 2.2
> DTD, run them through a processor, then prove that any content model
> legal in 2.0 will also be legal in 2.2 (though the opposite will
> obviously not be true). This could be done by hand as well (and as a
> derivative, you'd probably get a modular 2.0 DTD).
FYI, Earl Hood's PerlSGML package  includes a utility
called 'dtddiff' that does just this. It's very useful for
checking small changes to a DTD, but it might need a few
modifications to be useful in the case of a major overhaul.
I don't believe it's necessary that _every_ legal HTML 2.0 document
remain legal under a new DTD. In fact a stricter (prescriptive) DTD
would probably be more useful to authors than the (descriptive) one
in RFC 1866.
Good criteria for "compatibility" might be that 1) any document
conforming to the new DTD is also legal in HTML 2.0 after ignoring
unrecognized elements and attributes; and 2) documents conforming to
"HTML 2.0 Strict" and following the recommended practices in RFC 1866
are conformant when parsed against the new DTD.
For example, the declaration
<!ELEMENT DL - - (DT+, DD+)>
should be OK in the new DTD even though it disallows
which are legal but discouraged in HTML 2.0.
This should be _fairly_ easy to check by hand given a suitably
hacked 'dtddiff'. (A useful enhancement would be to "normalize"
the content models before comparing them, e.g., by removing
redundant model groups and sorting the content tokens in OR and
AND groups with some appropriate ordering criteria.)
[log in to unmask]