DOMElement クラス

(PHP 5, PHP 7, PHP 8)

クラス概要

classDOMElementextendsDOMNodeimplementsDOMParentNode, DOMChildNode {
publicreadonlystring$tagName;
publicstring$id;
publicreadonlymixed$schemaTypeInfo = null;
publicreadonlyint$childElementCount;
publicreadonlystring$nodeName;
publicreadonlyint$nodeType;
publicreadonly?DOMNode$parentNode;
publicreadonly?DOMElement$parentElement;
publicreadonlyDOMNodeList$childNodes;
publicreadonly?DOMNode$firstChild;
publicreadonly?DOMNode$lastChild;
publicreadonly?DOMNode$previousSibling;
publicreadonly?DOMNode$nextSibling;
publicreadonlybool$isConnected;
publicreadonly?string$namespaceURI;
publicreadonly?string$localName;
publicreadonly?string$baseURI;
public__construct(string$qualifiedName, ?string$value = null, string$namespace = "")
publicafter(DOMNode|string...$nodes): void
publicappend(DOMNode|string...$nodes): void
publicbefore(DOMNode|string...$nodes): void
publicgetAttribute(string$qualifiedName): string
publicgetAttributeNS(?string$namespace, string$localName): string
publicgetElementsByTagNameNS(?string$namespace, string$localName): DOMNodeList
publichasAttribute(string$qualifiedName): bool
publichasAttributeNS(?string$namespace, string$localName): bool
publicinsertAdjacentText(string$where, string$data): void
publicprepend(DOMNode|string...$nodes): void
publicremove(): void
publicremoveAttribute(string$qualifiedName): bool
publicremoveAttributeNS(?string$namespace, string$localName): void
publicreplaceWith(DOMNode|string...$nodes): void
publicsetAttribute(string$qualifiedName, string$value): DOMAttr|bool
publicsetAttributeNS(?string$namespace, string$qualifiedName, string$value): void
publicsetIdAttribute(string$qualifiedName, bool$isId): void
publicsetIdAttributeNode(DOMAttr$attr, bool$isId): void
publicsetIdAttributeNS(string$namespace, string$qualifiedName, bool$isId): void
publictoggleAttribute(string$qualifiedName, ?bool$force = null): bool
publicDOMNode::C14N(
    bool$exclusive = false,
    bool$withComments = false,
    ?array$xpath = null,
    ?array$nsPrefixes = null
): string|false
publicDOMNode::C14NFile(
    string$uri,
    bool$exclusive = false,
    bool$withComments = false,
    ?array$xpath = null,
    ?array$nsPrefixes = null
): int|false
publicDOMNode::isSameNode(DOMNode$otherNode): bool
publicDOMNode::isSupported(string$feature, string$version): bool
}

プロパティ

childElementCount

子要素の数。

firstElementChild

最初の子要素。存在しない場合は null になります。

lastElementChild

最後の子要素。存在しない場合は null になります。

nextElementSibling

次の兄弟要素。存在しない場合は null になります。

previousElementSibling

前の兄弟要素。存在しない場合は null になります。

schemaTypeInfo

未実装。常に null を返す。

tagName

要素名

className

スペースで分割された、要素のクラスを表す文字列

id

要素のID

変更履歴

バージョン説明
8.0.0 プロパティ firstElementChild, lastElementChild, childElementCount, previousElementSibling, nextElementSibling が追加されました。
8.0.0DOMElement は、 DOMParentNodeDOMChildNode を実装しました。

注意

注意:

DOM拡張モジュール は UTF-8 エンコーディングを使います。他のエンコーディングを扱う場合は、mb_convert_encoding(), UConverter::transcode(), iconv() を使ってください。

目次

To Top