XML DOM createDocument() method

Definition and Usage

The createDocument() method creates a new Document Objectand the specified root element.

Syntax:

nodeObject.createDocument(namespaceURI,qualifiedName,doctype)
Parameters Description
namespaceURI

The unique identifier of the namespace for the root element created for the document.

If there is no namespace, it will be null.

qualifiedName

The name of the root element created for the document.

If namespaceURI is not null, the name should include the namespace prefix and colon.

doctype

The DocumentType object of the newly created Document object.

If there is no desired DocumentType object, it will be null.

Return Value

A Document with the documentElement attribute Document Object, and set it as the root node of the specified type Element.

Description

This method creates a new Document Object, and specify the root object documentElement of the document. If the parameter doctype If it is not null, the ownerDocument property of the DocumentType object will be set to the newly created document.

This method is used to create an XML document, and it may not be supported by the implementation of HTML if it only supports HTML.

See

DomImplementation.createDocumentType()