The DOMElement class

Class synopsis

DOMElement
extends DOMNode
implements DOMParentNode DOMChildNode
/* Properties */
public readonly string $tagName;
public string $className;
public string $id;
public readonly mixed $schemaTypeInfo = null;
public readonly DOMElementnull $firstElementChild;
public readonly DOMElementnull $lastElementChild;
public readonly int $childElementCount;
public readonly DOMElementnull $previousElementSibling;
public readonly DOMElementnull $nextElementSibling;
/* Inherited properties */
public readonly string $nodeName;
public stringnull $nodeValue;
public readonly int $nodeType;
public readonly DOMNodenull $parentNode;
public readonly DOMElementnull $parentElement;
public readonly DOMNodeList $childNodes;
public readonly DOMNodenull $firstChild;
public readonly DOMNodenull $lastChild;
public readonly DOMNodenull $previousSibling;
public readonly DOMNodenull $nextSibling;
public readonly DOMNamedNodeMapnull $attributes;
public readonly bool $isConnected;
public readonly DOMDocumentnull $ownerDocument;
public readonly stringnull $namespaceURI;
public string $prefix;
public readonly stringnull $localName;
public readonly stringnull $baseURI;
public string $textContent;
/* Methods */
public DOMElement::__construct(string $qualifiedName, stringnull $value = null, string $namespace = "")
public void DOMElement::after(DOMNodestring ...$nodes)
public void DOMElement::append(DOMNodestring ...$nodes)
public void DOMElement::before(DOMNodestring ...$nodes)
public string DOMElement::getAttribute(string $qualifiedName)
public array DOMElement::getAttributeNames()
public DOMAttrDOMNameSpaceNodefalse DOMElement::getAttributeNode(string $qualifiedName)
public DOMAttrDOMNameSpaceNodenull DOMElement::getAttributeNodeNS(stringnull $namespace, string $localName)
public string DOMElement::getAttributeNS(stringnull $namespace, string $localName)
public DOMNodeList DOMElement::getElementsByTagName(string $qualifiedName)
public DOMNodeList DOMElement::getElementsByTagNameNS(stringnull $namespace, string $localName)
public bool DOMElement::hasAttribute(string $qualifiedName)
public bool DOMElement::hasAttributeNS(stringnull $namespace, string $localName)
public DOMElementnull DOMElement::insertAdjacentElement(string $where, DOMElement $element)
public void DOMElement::insertAdjacentText(string $where, string $data)
public void DOMElement::prepend(DOMNodestring ...$nodes)
public void DOMElement::remove()
public bool DOMElement::removeAttribute(string $qualifiedName)
public DOMAttrfalse DOMElement::removeAttributeNode(DOMAttr $attr)
public void DOMElement::removeAttributeNS(stringnull $namespace, string $localName)
public void DOMElement::replaceChildren(DOMNodestring ...$nodes)
public void DOMElement::replaceWith(DOMNodestring ...$nodes)
public DOMAttrbool DOMElement::setAttribute(string $qualifiedName, string $value)
public DOMAttrnullfalse DOMElement::setAttributeNode(DOMAttr $attr)
public DOMAttrnullfalse DOMElement::setAttributeNodeNS(DOMAttr $attr)
public void DOMElement::setAttributeNS(stringnull $namespace, string $qualifiedName, string $value)
public void DOMElement::setIdAttribute(string $qualifiedName, bool $isId)
public void DOMElement::setIdAttributeNode(DOMAttr $attr, bool $isId)
public void DOMElement::setIdAttributeNS(string $namespace, string $qualifiedName, bool $isId)
public bool DOMElement::toggleAttribute(string $qualifiedName, boolnull $force = null)
/* Inherited methods */
public DOMNodefalse appendChild(DOMNode $node)
public stringfalse C14N(
    bool $exclusive = false,
    bool $withComments = false,
    arraynull $xpath = null,
    arraynull $nsPrefixes = null
)
public intfalse C14NFile(
    string $uri,
    bool $exclusive = false,
    bool $withComments = false,
    arraynull $xpath = null,
    arraynull $nsPrefixes = null
)
public DOMNodefalse cloneNode(bool $deep = false)
public int compareDocumentPosition(DOMNode $other)
public bool contains(DOMNodeDOMNameSpaceNodenull $other)
public int getLineNo()
public stringnull getNodePath()
public DOMNode getRootNode(arraynull $options = null)
public bool hasAttributes()
public bool hasChildNodes()
public DOMNodefalse insertBefore(DOMNode $node, DOMNodenull $child = null)
public bool isDefaultNamespace(string $namespace)
public bool isEqualNode(DOMNodenull $otherNode)
public bool isSameNode(DOMNode $otherNode)
public bool isSupported(string $feature, string $version)
public stringnull lookupNamespaceURI(stringnull $prefix)
public stringnull lookupPrefix(string $namespace)
public void normalize()
public DOMNodefalse removeChild(DOMNode $child)
public DOMNodefalse replaceChild(DOMNode $node, DOMNode $child)

Properties

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

Changelog

Version Description
8.0.0 The firstElementChild, lastElementChild, childElementCount, previousElementSibling, and nextElementSibling properties have been added.
8.0.0 DOMElement implements DOMParentNode and DOMChildNode now.

Notes

Note:

The DOM extension uses UTF-8 encoding. Use mb_convert_encoding, UConverter::transcode, or iconv to handle other encodings.

Table of Contents