W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2001

Appending DocumentType Nodes

From: Ryan Lubke <Ryan.Lubke@Sun.COM>
Date: 26 Oct 2001 15:51:59 -0400
To: www-dom@w3c.org
Message-Id: <1004125919.1319.46.camel@treepoint.east.sun.com>
Hello,

I'm looking for clarification on teh validity of appending
DocumentType nodes using Document.appendChild().

From consultations with peers, the Dom Lvl2 way of creating a Document
with a DocumentType is:
   dtd = domImplementation.createDocumentType( "root", null, null );
   domImplementation.createDocument( null, "root", dtd );

However should the following code work or throw a DOMException
of type WRONG_DOCUMENT_ERR:


document.appendChild(document.getImplementation().createDocumentType("root", null, null));

Thoughts?  Comments?

Thanks,

Ryan Lubke
	
Received on Friday, 26 October 2001 15:46:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:55 GMT