Programmer's Guide > Interfaces > W3C DOMImplementation interface > createDocument method
  
createDocument method
Creates an XML Document object of the specified type with its document element. HTML-only DOM implementations do not need to implement this method.
createDocument(namespaceURI, qualifiedName, doctype)
Parameters
StringnamespaceURI
The namespace URI of the document element to create.
StringqualifiedName
The qualified name of the document element to be created.
DocumentTypedoctype
The type of document to be created or null.
When doctype is not null, its Node.ownerDocument attribute is set to the document being created.
Returns
Document. A new Document object.
Throws
DOMException
INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character.
NAMESPACE_ERR: Raised if the qualifiedName is malformed, if the qualifiedName has a prefix and the namespaceURI is null, or if the qualifiedName has a prefix that is "xml" and the namespaceURI is different from " http://www.w3.org/XML/1998/namespace" [XML Namespaces].
WRONG_DOCUMENT_ERR: Raised if doctype has already been used with a different document or was created from a different implementation.