--- Lib/xml/dom/expatbuilder.py.orig 2006-02-13 20:53:44.000000000 +0100 +++ Lib/xml/dom/expatbuilder.py 2006-02-13 20:55:29.000000000 +0100 @@ -242,7 +242,7 @@ doctype = self.document.implementation.createDocumentType( doctypeName, publicId, systemId) doctype.ownerDocument = self.document - self.document.childNodes.append(doctype) + _append_child(self.document, doctype) self.document.doctype = doctype if self._filter and self._filter.acceptNode(doctype) == FILTER_REJECT: self.document.doctype = None