XML DOM createDocument() 方法
定义和用法
createDocument() 方法创建一个新 Document object和指定的根元素。
语法:
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 expected DocumentType object, it will be null. |
Return value
An object with the documentElement attribute Document object, and set it as the root node of the specified type of Element.
Description
This method creates a new Document object, and specify the root object of the document as documentElement. 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, which may not be supported by the implementation of HTML. It only supports HTML.