IDOMImplementation.CreateDocument(String, String, IDocumentType) 方法

定义

使用指定类型的文档元素创建 DOM Document 对象。

[Android.Runtime.Register("createDocument", "(Ljava/lang/String;Ljava/lang/String;Lorg/w3c/dom/DocumentType;)Lorg/w3c/dom/Document;", "GetCreateDocument_Ljava_lang_String_Ljava_lang_String_Lorg_w3c_dom_DocumentType_Handler:Org.W3c.Dom.IDOMImplementationInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Org.W3c.Dom.IDocument? CreateDocument (string? namespaceURI, string? qualifiedName, Org.W3c.Dom.IDocumentType? doctype);
[<Android.Runtime.Register("createDocument", "(Ljava/lang/String;Ljava/lang/String;Lorg/w3c/dom/DocumentType;)Lorg/w3c/dom/Document;", "GetCreateDocument_Ljava_lang_String_Ljava_lang_String_Lorg_w3c_dom_DocumentType_Handler:Org.W3c.Dom.IDOMImplementationInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member CreateDocument : string * string * Org.W3c.Dom.IDocumentType -> Org.W3c.Dom.IDocument

参数

namespaceURI
String

要创建或创建 null的文档元素的命名空间 URI。

qualifiedName
String

要创建的文档元素的限定名称或 null

doctype
IDocumentType

要创建的文档的类型或 null。 如果 doctype 不是 null,则其 Node.ownerDocument 属性设置为正在创建的文档。

返回

包含其文档元素的新 Document 对象。 如果返回且qualifiedNameNamespaceURIdoctype返回null的值为空,Document且没有文档元素。

属性

例外

INVALID_CHARACTER_ERR:如果指定的限定名称不是根据 [] 的 XML 名称,则引发此名称。
NAMESPACE_ERR:如果qualifiedName格式不正确,则引发该前缀,如果qualifiedName前缀和namespaceURI前缀nullnamespaceURInullnull相同,qualifiedName或者qualifiedName具有前缀为“xml”且namespaceURI与“”[] 不同,或者 DOM 实现不支持"XML"该功能,但提供了非 null 命名空间 URI,因为命名空间由 XML 定义。
WRONG_DOCUMENT_ERR:如果 doctype 已与其他文档一起使用,或者已从其他实现创建,则引发。
NOT_SUPPORTED_ERR:如果实现不支持功能“XML”,并且通过文档公开的语言不支持 XML 命名空间(如 []),则可能会引发。

注解

使用指定类型的文档元素创建 DOM Document 对象。 <br>请注意,根据 DocumentType 给定的创建文档,实现可以实例化支持“核心”以外的附加功能的专用 Document 对象,如“HTML”[DOM 级别 2 HTML] 。 另一方面,在创建文档后设置 DocumentType 使得这种情况不太可能发生。 或者,专用 Document 创建方法(如 createHTMLDocument [DOM 级别 2 HTML])可用于获取特定类型的 Document 对象。

在 DOM 级别 2 中添加。

适用于 . 的 org.w3c.dom.DOMImplementation.createDocument(java.lang.String, java.lang.String, org.w3c.dom.DocumentType)Java 文档

本页的某些部分是根据 Android 开放源代码项目创建和共享的工作进行的修改,并根据 Creative Commons 2.5 属性许可证中所述的术语使用。

适用于