Re: Dynamic Doctype generation

The DocumentType was defined as being set only at document creation time
because there was a concern that some DOM implementations might want to
select different subclasses based on the kind of document being processed.
(The requirement that createDocument() also create the Document Element,
which may never be replaced thereafter, partly arose from the same
concern... though there was a well-formedness issue as well.)

For example: A DOM implementation might want to recognize HTML documents
and automatically create an HTMLDocument rather than a core Document.

We recognize that this isn't an ideal sequence for those of you writing
parsers, which may need to stack up a series of doctypes and PIs and
comments before you have enough information to call createDocument. DOM
Level 3 may introduce alternative approaches to document creation which
relax this. And DOM Level 3's Content Model work may introduce the ability
to alter or replace the DocumentType on an existing document. But this is
all work-in-progress and wasn't ready for standardization in DOM Level 2.

______________________________________
Joe Kesselman  / IBM Research

Received on Tuesday, 10 April 2001 11:25:35 UTC