DOMElement::setAttributeNodeNS

(PHP 5, PHP 7, PHP 8)

DOMElement::setAttributeNodeNSAñade un nuevo atributo al elemento

Descripción

public DOMElement::setAttributeNodeNS(DOMAttr $attr): DOMAttr|null|false

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

DOM_WRONG_DOCUMENT_ERR

Se lanza si attr pertenece a un documento diferente al del elemento.

Ver también

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top