« DOMDocument::__construct
DOMDocument::createAttributeNS »

DOMDocument::createAttribute

(PHP 5, PHP 7, PHP 8)

DOMDocument::createAttribute — 新しい属性を作成する

説明

public function DOMDocument::createAttribute(string $localName): DOMAttr|false

この関数は、DOMAttr クラスの新しいインスタンスを作成します。 このノードは、( DOMNode::appendChild() などで) 挿入されない限り、ドキュメント内にあらわれません。

パラメータ

localName

属性の名前。

戻り値

新しい DOMAttr、あるいはエラーが発生した場合は false を返します。

エラー / 例外

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

DOM_INVALID_CHARACTER_ERR

localName が無効な文字を含んでいる場合に発生します。

参考

関連キーワード:
DOMDocument   ノード   属性   createAttribute   localName   DOMAttr   createAttributeNS   DOMNode   appendChild   関連   空間   construct   インスタンス   挿入   ドキュメント   エラーコード   DOMException   無効   参考   最後   createCDATASection   cdata   createComment   comment   createDocumentFragment
関連する関数・ページ:
domdocument.createcdatasection   domdocument.createcomment   domdocument.createdocumentfragment   domdocument.createtextnode   domdocument.createattributens   domdocument.createprocessinginstruction