DOMElement::setAttributeNodeNS
En esta página
DOMElement::setAttributeNodeNS
Añade un nuevo atributo al elemento
Descripción#
php
public DOMElement::setAttributeNodeNS(DOMAttr $attr): DOMAttrphp
Añade un nuevo atributo attr al elemento, teniendo en cuenta el espacio de nombres (namespace): Si ya existe un atributo con el mismo nombre en el elemento, este atributo es reemplazado por attr.
Parámetros#
attr
El nombre del atributo.
Valores devueltos#
Devuelve el antiguo atributo si ha sido reemplazado o null si no había un atributo anterior. Si se produce un error DOM_WRONG_DOCUMENT_ERR y strictErrorChecking es false, entonces se devuelve false.
Errores/Excepciones#
Puede lanzar una DOMException con los siguientes códigos de error:
DOM_WRONG_DOCUMENT_ERR
Se lanza si attr pertenece a un documento diferente al del elemento.
Véase también#
DOMElement::hasAttributeNS, DOMElement::getAttributeNodeNS, DOMElement::removeAttributeNode