La classe DOMElement

(PHP 5, PHP 7, PHP 8)

Synopsis de la classe

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
}

Propriétés

childElementCount

Le nombre d'éléments enfants.

firstElementChild

Premier élément enfant ou null.

lastElementChild

Dernier élément enfant ou null.

nextElementSibling

L'élément frère suivant ou null.

previousElementSibling

L'élément frère précédent ou null.

schemaTypeInfo

Pas encore implémenté, retourne toujours null

tagName

Le nom de l'élément

className

Une chaîne représentant les classes de l'élément, séparé par des espaces

id

L'ID de l'élément

Historique

VersionDescription
8.0.0 Les propriétés firstElementChild, lastElementChild, childElementCount, previousElementSibling et nextElementSibling ont été ajoutées.
8.0.0DOMElement implémente désormais DOMParentNode et DOMChildNode.

Notes

Note:

L'extension DOM utilise l'encodage UTF-8. Utilisez mb_convert_encoding(), UConverter::transcode(), ou iconv() pour manipuler d'autres encodages.

Sommaire

To Top