Compartilhar via


IDocument.CreateAttributeNS(String, String) Method

Definition

Creates an attribute of the given qualified name and namespace URI.

[Android.Runtime.Register("createAttributeNS", "(Ljava/lang/String;Ljava/lang/String;)Lorg/w3c/dom/Attr;", "GetCreateAttributeNS_Ljava_lang_String_Ljava_lang_String_Handler:Org.W3c.Dom.IDocumentInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Org.W3c.Dom.IAttr? CreateAttributeNS (string? namespaceURI, string? qualifiedName);
[<Android.Runtime.Register("createAttributeNS", "(Ljava/lang/String;Ljava/lang/String;)Lorg/w3c/dom/Attr;", "GetCreateAttributeNS_Ljava_lang_String_Ljava_lang_String_Handler:Org.W3c.Dom.IDocumentInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member CreateAttributeNS : string * string -> Org.W3c.Dom.IAttr

Parameters

namespaceURI
String

The namespace URI of the attribute to create.

qualifiedName
String

The qualified name of the attribute to instantiate.

Returns

A new Attr object with the following attributes: <table border='1' cellpadding='3'> <tr> <th> Attribute</th> <th>Value</th> </tr> <tr> <td valign='top' rowspan='1' colspan='1'>Node.nodeName</td> <td valign='top' rowspan='1' colspan='1'>qualifiedName</td> </tr> <tr> <td valign='top' rowspan='1' colspan='1'> Node.namespaceURI</td> <td valign='top' rowspan='1' colspan='1'>namespaceURI</td> </tr> <tr> <td valign='top' rowspan='1' colspan='1'> Node.prefix</td> <td valign='top' rowspan='1' colspan='1'>prefix, extracted from qualifiedName, or null if there is no prefix</td> </tr> <tr> <td valign='top' rowspan='1' colspan='1'>Node.localName</td> <td valign='top' rowspan='1' colspan='1'>local name, extracted from qualifiedName</td> </tr> <tr> <td valign='top' rowspan='1' colspan='1'>Attr.name</td> <td valign='top' rowspan='1' colspan='1'> qualifiedName</td> </tr> <tr> <td valign='top' rowspan='1' colspan='1'>Node.nodeValue</td> <td valign='top' rowspan='1' colspan='1'>the empty string</td> </tr> </table>

Attributes

Exceptions

INVALID_CHARACTER_ERR: Raised if the specified qualifiedName is not an XML name according to the XML version in use specified in the Document.xmlVersion attribute.
NAMESPACE_ERR: Raised if the qualifiedName is a malformed qualified name, if the qualifiedName has a prefix and the namespaceURI is null, if the qualifiedName has a prefix that is "xml" and the namespaceURI is different from "", if the qualifiedName or its prefix is "xmlns" and the namespaceURI is different from "", or if the namespaceURI is "" and neither the qualifiedName nor its prefix is "xmlns".
NOT_SUPPORTED_ERR: Always thrown if the current document does not support the "XML" feature, since namespaces were defined by XML.

Remarks

Creates an attribute of the given qualified name and namespace URI. <br>Per [XML Namespaces] , applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

Added in DOM Level 2.

Java documentation for org.w3c.dom.Document.createAttributeNS(java.lang.String, 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