Org.W3c.Dom.IElement.SetAttribute Method
Adds a new attribute.

Syntax

[Android.Runtime.Register("setAttribute", "(Ljava/lang/String;Ljava/lang/String;)V", "GetSetAttribute_Ljava_lang_String_Ljava_lang_String_Handler:Org.W3c.Dom.IElementInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public void SetAttribute (string name, string value)

Parameters

name
The name of the attribute to create or alter.
value
Value to set in string form.

Exceptions

TypeReason
Org.W3c.Dom.DOMExceptionINVALID_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.

NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

Remarks

Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an Attr node plus any Text and EntityReference nodes, build the appropriate subtree, and use setAttributeNode to assign it as the value of an attribute.

To set an attribute with a qualified name and namespace URI, use the setAttributeNS method.

[Android Documentation]

Requirements

Namespace: Org.W3c.Dom
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1