# The Dom\Document class

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

&reftitle.classsynopsis;

         abstract
         Dom\Document

         extends
         Dom\Node

         implements
         Dom\ParentNode

        &InheritedConstants;

        &Properties;

         public
         readonly
         Dom\Implementation
         implementation

         public
         string
         URL

         public
         string
         documentURI

         public
         string
         characterSet

         public
         string
         charset

         public
         string
         inputEncoding

         public
         readonly
         Dom\DocumentTypenull
         doctype

         public
         readonly
         Dom\Elementnull
         documentElement

         public
         readonly
         Dom\Elementnull
         firstElementChild

         public
         readonly
         Dom\Elementnull
         lastElementChild

         public
         readonly
         int
         childElementCount

         public
         Dom\HTMLElementnull
         body

         public
         readonly
         Dom\HTMLElementnull
         head

         public
         string
         title

        &InheritedProperties;

        &Methods;
        Not documented yet

        &InheritedMethods;
        Not documented yet

&reftitle.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.