Partager via


IDocument.CreateElement(String) Method

Definition

Creates an element of the type specified.

[Android.Runtime.Register("createElement", "(Ljava/lang/String;)Lorg/w3c/dom/Element;", "GetCreateElement_Ljava_lang_String_Handler:Org.W3c.Dom.IDocumentInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Org.W3c.Dom.IElement? CreateElement (string? tagName);
[<Android.Runtime.Register("createElement", "(Ljava/lang/String;)Lorg/w3c/dom/Element;", "GetCreateElement_Ljava_lang_String_Handler:Org.W3c.Dom.IDocumentInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member CreateElement : string -> Org.W3c.Dom.IElement

Parameters

tagName
String

The name of the element type to instantiate. For XML, this is case-sensitive, otherwise it depends on the case-sensitivity of the markup language in use. In that case, the name is mapped to the canonical form of that markup by the DOM implementation.

Returns

A new Element object with the nodeName attribute set to tagName, and localName, prefix, and namespaceURI set to null.

Attributes

Exceptions

INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute.

Remarks

Creates an element of the type specified. Note that the instance returned implements the Element interface, so attributes can be specified directly on the returned object. <br>In addition, if there are known attributes with default values, Attr nodes representing them are automatically created and attached to the element. <br>To create an element with a qualified name and namespace URI, use the createElementNS method.

Java documentation for org.w3c.dom.Document.createElement(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to