docType is initialized to null first and later assigned the value of doctype within DocumentImpl::appendChild(doctype). Note that DocumentImpl::appendChild() is resolved to NodeImpl::appendChild() which in turn calls DocumentImpl::insertBefore() to check if docType already exists then do the assignment.
Chih-Hsiang Chou IBM Center for Java Technology - Silicon Valley [EMAIL PROTECTED] ----- Original Message ----- From: "Steve Dickson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, April 03, 2000 6:36 PM Subject: DocumentImpl::docType Note: this message has been forwarded to both the xerces-dev and xerces-dev-c mailing lists Using Xerces C, DocumentImpl.cpp Revision 1.11 2000/03/02 Both of the DocumentImpl constructors assign DocumentImpl::docType to NULL which, in turn, means that DocumentImpl::getDoctype() always returns NULL. I'm suspicious of the following constructor, in which a DocumentTypeImpl* object is passed in [note: I have slightly modified the following fragment for clarity]: file://DOM Level 2 DocumentImpl::DocumentImpl( const DOMString &fNamespaceURI, const DOMString &qualifiedName, DocumentTypeImpl *doctype) : NodeImpl(null, DStringPool::getStaticString("#document", &nam), DOM_Node::DOCUMENT_NODE, false, null) { if (doctype != null && doctype->getOwnerDocument() != null) throw DOM_DOMException( file://one doctype can belong to only one DocumentImpl DOM_DOMException::WRONG_DOCUMENT_ERR, null ); docType=null; if (doctype != null) { doctype -> setOwnerDocument(this); appendChild(doctype); doctype -> referenced(); // ??? docType = doctype; ???? Shouldn't this be assigned here? } [snipped to save space] } Shouldn't SVGDocumentImpl::docType be assigned doctype in this code block where indicated by the ??? comment above? There doesn't seem to be any other way to assign to DocumentImpl::docType. S.