XML DOM createDocument() 方法

DomImplementation 对象参考手册

定义和用法

createDocument() 方法创建一个新 Document 对象和指定的根元素。

语法:

nodeObject.createDocument(namespaceURI,qualifiedName,doctype)
参数 描述
namespaceURI

为文档创建的根元素的命名空间的唯一标识符。

如果没有命名空间,则为 null。

qualifiedName

为文档创建的根元素的名称。

如果 namespaceURI 不为 null,该名称应该包括命名空间前缀和冒号。

doctype

新创建的 Document 对象的 DocumentType 对象。

如果没有想得到的 DocumentType 对象,则为 null。

本在线速查手册由www.w♧☜♥3♧☜♥x♧☜♥u♧☜♥e.com提供,请勿盗用!

返回值

一个带有 documentElement 属性的 Document 对象,设置为指定类型的 Element 根节点。

说明

该方法创建一个新的 Document 对象,并为文档指定它的根对象 documentElement。如果参数 doctype 不是 null,那么 DocumentType 对象的 ownerDocument 属性将被设置为新创建的文档。

该方法用于创建 XML 文档,只支持 HTML 的实现可能不支持它。

参阅

DomImplementation.createDocumentType()

DomImplementation 对象参考手册