◐ Shell
clean mode source ↗

PHP: Dom\Node - Manual

The Dom\Node class

(PHP 8 >= 8.4.0)

Introduction

This is the modern, spec-compliant equivalent of DOMNode.

Class synopsis

Properties

nodeType

Gets the type of the node. One of the predefined XML_*_NODE constants

nodeName
Returns the most accurate name for the current node type.
  • For elements, this is the HTML-uppercased qualified name.
  • For attributes, this is the qualified name.
  • For processing instructions, this is the target.
  • For document type nodes, this is the name.
baseURI

The absolute base URI of this node or null if the implementation wasn't able to obtain an absolute URI.

isConnected

Whether the node is connected to a document

ownerDocument
The Dom\Document object associated with this node, or null if this node is a document.
parentNode

The parent of this node. If there is no such node, this returns null.

parentElement

The parent element of this element. If there is no such element, this returns null.

childNodes
A Dom\NodeList that contains all children of this node. If there are no children, this is an empty Dom\NodeList.
firstChild

The first child of this node. If there is no such node, this returns null.

lastChild

The last child of this node. If there is no such node, this returns null.

previousSibling

The node immediately preceding this node. If there is no such node, this returns null.

nextSibling

The node immediately following this node. If there is no such node, this returns null.

nodeValue
The value of this node, depending on its type.
textContent

The text content of this node and its descendants.

Notes

Note: The DOM extension uses UTF-8 encoding when working with methods or properties. The parser methods auto-detect the encoding or allow the caller to specify an encoding.

Found A Problem?

There are no user contributed notes for this page.