DOMElement::setAttributeNS
(PHP 5, PHP 7, PHP 8)
Adds new attribute
Description
Sets an attribute with namespace namespace and name qualifiedName to the given value. If the attribute does not exist, it will be created.
Parameters
namespaceThe namespace URI.
qualifiedNameThe qualified name of the attribute, as
prefix:tagname.valueThe value of the attribute.
Return Values
Void
Errors/Exceptions
May throw a DOMException with the following error codes:
DOM_NO_MODIFICATION_ALLOWED_ERRRaised if the node is readonly.
DOM_NAMESPACE_ERRRaised if
qualifiedNameis a malformed qualified name, or ifqualifiedNamehas a prefix andnamespaceis null.
See Also
DOMElement::hasAttributeNSDOMElement::getAttributeNSDOMElement::removeAttributeNS