# File lib/xml/dom2/domimplementation.rb, line 41
      def createDocument(nsuri, qname, doctype)
        raise DOMException.new(DOMException::WRONG_DOCUMENT_ERR) if
          doctype && doctype.ownerDocument
        doc = Document.new
        if doctype
          doc.appendChild(doctype)
          doctype.ownerDocument = doc
        end
        elem = doc.createElementNS(nsuri, qname)
        doc.appendChild(elem)
        doc.implementation = self
        doc
      end