Re: Comments on DOM 2

Dieter Köhler wrote:
> 
> COMMENT ON § 1.2.
> 
> IMO the createDocumentType method should be placed in the Document
> interface, since a DocumentType node is considered a child node of a
> Document node.  It has to be inserted into the document tree, because
> its position in the XML Document is not fixed as the follwing example
> shows:
> 
> <?xml version = "1.0" encoding = "UTF-32" ?>
> <!-- comment 1 -->
> <?ProcessingInstruction ... ?>
> <!-- comment 2 -->
> <!DOCTYPE ... >
> <!-- comment 3 -->
> <!-- comment 4 -->
> ...
> 
> So it would be better to treat it like every other node which can be
> part of the document tree.
> 
> Therefore, also the createDocument method of the DomImplementation
> interface should not contain any doctype parameter. Instead, the
> application should be responsible for creating a Document Type node with
> the above suggested method of the Document interface, and add it to the
> child nodes of the Document node which created it.

We've actually debated this over and decided otherwise. The reason is
that this would mean one would first create an untyped document and then
sets its type by inserting a DocumentType node in it. And possibly
change it again at any given time.
However, changing a document type can have a huge impact on the
document, since it impacts entities and default attributes. For that
reason the type of the document is immutable and as to set at the time a
document gets created. Which is why the DOM interfaces have to be the
way they are.
-- 
Arnaud

Received on Thursday, 16 September 1999 10:27:26 UTC