php8.5
Home/ Manual/ dom / dom/ The Dom\Document class

The Dom\Document class

This is the modern, spec-compliant equivalent of DOMDocument. It is the base class for Dom\XMLDocument and Dom\HTMLDocument.

This is the modern, spec-compliant equivalent of DOMDocument. It is the base class for Dom\XMLDocument and Dom\HTMLDocument.

Class synopsis

abstract Dom\Document extends Dom\Node implements Dom\ParentNode { }

Properties

URL

Equivalent to documentURI.

characterSet

The encoding of the document used for serialization. Upon parsing a document, this is set to the input encoding of that document.

inputEncoding

Legacy alias for characterSet.

charset

Legacy alias for characterSet.

documentElement

The Dom\Element that is the document element. This evaluates to null for document without elements.

body

The first child of the html element that is either a body tag or a frameset tag. These need to be in the HTML namespace. If no element matches, this evaluates to null.

head

The first head element that is a child of the html element. These need to be in the HTML namespace. If no element matches, this evaluates to null.

title

The title of the document as set by the title element for HTML or the SVG title element for SVG. If there is no title, this evaluates to the empty string.

Source: reference/dom/dom/dom-document.xml · from the official PHP manual (php/doc-en)