Node setNamedItem(Node arg) throws DOMException;
arg
The node to be added to the NamedNodeMap.
The node that was replaced, or null if no node was replaced.
This method may throw a DOMException with one of the following code values:
HIERARCHY_REQUEST_ERR
arg is a node of a type that is not suitable for this NamedNodeMap (e.g., is not an Attr node).
INUSE_ATTRIBUTE_ERR
arg is an Attr node that is already associated with an element.
NO_MODIFICATION_ALLOWED_ERR
The NamedNodeMap is read-only.
WRONG_DOCUMENT_ERR
arg has a different ownerDocument than the document from which the NamedNodeMap was created.
setNamedItem( ) adds the specified node to a NamedNodeMap and allows it to be looked up using the value of the node's nodeName property. If the NamedNodeMap already contains a node with that name, that node is replaced and becomes the return value of the method.