The DOMElement class

(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

The number of child elements.

firstElementChild

First child element or null.

lastElementChild

Last child element or null.

nextElementSibling

The next sibling element or null.

previousElementSibling

The previous sibling element or null.

schemaTypeInfo

Not implemented yet, always return null

tagName

The element name

className

A string representing the classes of the element separated by spaces

id

The element ID

更新日志

版本说明
8.0.0 The firstElementChild, lastElementChild, childElementCount, previousElementSibling, and nextElementSibling properties have been added.
8.0.0DOMElement implements DOMParentNode and DOMChildNode now.

注释

注意:

此 DOM 扩展采用 UTF-8 编码。使用 mb_convert_encoding()UConverter::transcode()iconv() 来处理其它编码。

目录

To Top