| 1 |
--- |
| 2 |
title: simple_html_dom |
| 3 |
--- |
| 4 |
|
| 5 |
# simple_html_dom |
| 6 |
|
| 7 |
Represents the [](https://en.wikipedia.org/wiki/Document_Object_ModelDOM](https://en.wikipedia.org/wiki/Document_Object_Model](https://en.wikipedia.org/wiki/Document_Object_Model) in memory. Provides functions to parse documents and access individual elements (see [](../simple_html_dom_node/simple_html_dom_node.md`simple_html_dom_node`](../simple_html_dom_node/simple_html_dom_node.md](../simple_html_dom_node/simple_html_dom_node.md)). |
| 8 |
|
| 9 |
# Public Properties |
| 10 |
|
| 11 |
| Property | Description |
| 12 |
| -------- | ----------- |
| 13 |
| `root` | Root node of the document. |
| 14 |
| `nodes` | List of top-level nodes in the document. |
| 15 |
| `callback` | Callback function that is called for each element in the DOM when generating outertext. |
| 16 |
| `lowercase` | If enabled, all tag names are converted to lowercase when parsing documents. |
| 17 |
| `original_size` | Original document size in bytes. |
| 18 |
| `size` | Current document size in bytes. |
| 19 |
| `_charset` | Charset of the original document. |
| 20 |
| `_target_charset` | Target charset for the current document. |
| 21 |
| `default_span_text` | Text to return for `<span>` elements. |
| 22 |
|
| 23 |
# Protected Properties |
| 24 |
|
| 25 |
| Property | Description |
| 26 |
| -------- | ----------- |
| 27 |
| `pos` | Current parsing position within `doc`. |
| 28 |
| `doc` | The original document. |
| 29 |
| `char` | Character at position `pos` in `doc`. |
| 30 |
| `cursor` | Current element cursor in the document. |
| 31 |
| `parent` | Parent element node. |
| 32 |
| `noise` | Noise from the original document (i.e. scripts, comments, etc...). |
| 33 |
| `token_blank` | Tokens that are considered whitespace in HTML. |
| 34 |
| `token_equal` | Tokens to identify the equal sign for attributes, stopping either at the closing tag ("/" i.e. `<html />`) or the end of an opening tag (">" i.e. `<html>`). |
| 35 |
| `token_slash` | Tokens to identify the end of a tag name. A tag name either ends on the ending slash ("/" i.e. `<html/>`) or whitespace (`"\s\r\n\t"`). |
| 36 |
| `token_attr` | Tokens to identify the end of an attribute. |
| 37 |
| `default_br_text` | Text to return for `<br>` elements. |
| 38 |
| `self_closing_tags` | A list of tag names where the closing tag is omitted. |
| 39 |
| `block_tags` | A list of tag names where remaining unclosed tags are forcibly closed. |
| 40 |
| `optional_closing_tags` | A list of tag names where the closing tag can be omitted. |