Share via


IElement.SetAttributeNodeNS(IAttr) Method

Definition

Adds a new attribute.

[Android.Runtime.Register("setAttributeNodeNS", "(Lorg/w3c/dom/Attr;)Lorg/w3c/dom/Attr;", "GetSetAttributeNodeNS_Lorg_w3c_dom_Attr_Handler:Org.W3c.Dom.IElementInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Org.W3c.Dom.IAttr? SetAttributeNodeNS (Org.W3c.Dom.IAttr? newAttr);
[<Android.Runtime.Register("setAttributeNodeNS", "(Lorg/w3c/dom/Attr;)Lorg/w3c/dom/Attr;", "GetSetAttributeNodeNS_Lorg_w3c_dom_Attr_Handler:Org.W3c.Dom.IElementInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member SetAttributeNodeNS : Org.W3c.Dom.IAttr -> Org.W3c.Dom.IAttr

Parameters

newAttr
IAttr

The Attr node to add to the attribute list.

Returns

If the newAttr attribute replaces an existing attribute with the same local name and namespace URI, the replaced Attr node is returned, otherwise null is returned.

Attributes

Exceptions

WRONG_DOCUMENT_ERR: Raised if newAttr was created from a different document than the one that created the element.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
INUSE_ATTRIBUTE_ERR: Raised if newAttr is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.
NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as []).

Remarks

Adds a new attribute. If an attribute with that local name and that namespace URI is already present in the element, it is replaced by the new one. Replacing an attribute node by itself has no effect. <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.Element.setAttributeNodeNS(org.w3c.dom.Attr).

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