« DOMElement::setAttributeNodeNS
DOMElement::setIdAttribute »

DOMElement::setAttributeNS

(PHP 5, PHP 7, PHP 8)

DOMElement::setAttributeNS — 新しい属性を追加する

説明

public function DOMElement::setAttributeNS(?string $namespace, string $qualifiedName, string $value): void

名前空間 namespace にある qualifiedName という名前の属性を、指定した値に設定します。 属性が存在しない場合は、作成されます。

パラメータ

namespace

名前空間 URI。

qualifiedName

prefix:tagname 形式で表した属性名。

value

属性の値。

戻り値

値を返しません。

エラー / 例外

以下のエラーコードで DOMException をスローします:

DOM_NO_MODIFICATION_ALLOWED_ERR

ノードが読み込み専用の場合に発生します。

DOM_NAMESPACE_ERR

qualifiedName が不正な形式であった場合や、 qualifiedName がプレフィックスを含むにもかかわらず namespace が null の場合に発生します。

参考

関連キーワード:
属性   DOMElement   qualifiedName   namespace   setAttributeNS   空間   setAttributeNodeNS   setIdAttribute   prefix   tagname   エラーコード   DOMException   ノード   専用   不正   プレフィックス   参考   hasAttributeNS   getAttributeNS   removeAttributeNS
関連する関数・ページ:
domelement.getattribute   domelement.removeattributens   domelement.removeattribute   domelement.hasattribute   domelement.hasattributens   domelement.getattributens