Dieter KÃ¶hler wrote:
> One addition to my last posting: The current spec provides no
> information, how to add a DocumentType node created by the
> DOMImplementation to a Document node: The ownerDocument attribute of a
> new DocumentType has the value 'null'. The methods for adding nodes
> to a node raise a "WRONG_DOCUMENT_ERR" if the node to be added "was
> created from a different document than the one that created this
> node". So what should be done if one tries to add a node not created
> by any document at all? Raise a "WRONG_DOCUMENT_ERR"? -- The
> ownerDocument definition on p. 43 seems to presuppose, that the node
> should be added and change its ownerDocument attribute. If that is
> right, then it would be good to mention it in the definitions of the
> methods it affects.
DOM level 2 provides only one way to use a DocumentType node once
you have created it:
Pass it to createDocument, where it says:
"When doctype is not null, its Node.ownerDocument attribute is set to the
document being created".
This is a minimal capability, which does not satisfy a number of cases,
especially not that of a parser, which probably does not discover the
doctype until after the document has been created, needs to be
able to add entities and notations as declarations are encountered, and
may need to preserve additional internal subset information. Parsers
will
probably need to rely on proprietary interfaces until more is defined.
But it does allow a new document to be created with a specified doctype.
Ray Whitmer
ray@xmission.com