(PHP 5, PHP 7, PHP 8)
DOMElement::setAttributeNodeNS — Añade un nuevo atributo al elemento
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
.
attr
El nombre del atributo.
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
.
DOM_WRONG_DOCUMENT_ERR
Se lanza si attr
pertenece a un documento diferente al del elemento.