Menu

## DOMParser
in package

DOMParser.php : 18

Class for DOM Parsing.

##### Tags

see
  https://www.kotchasan.com/

### Table of Contents

$doms : array<string|int, mixed>
  Array of nodes.
__construct() : mixed
  Class constructor.
load() : static
  Parse HTML from URL.
nodes() : array<string|int, mixed>
  Get all nodes.
toHTML() : string
  Export the parsed HTML code as a string.
drawNode() : string
  Draw the node and its descendants recursively.
populate() : mixed
  Populate previousSibling and nextSibling for each node recursively.

### Properties

#### $doms

DOMParser.php : 25

Array of nodes.

`protected array<string|int, mixed> $doms = []`

### Methods

#### __construct()

DOMParser.php : 33

Class constructor.

`public __construct(string $html[, string $charset = 'utf-8' ]) : mixed`

##### Parameters

$html : string

  HTML code.

$charset : string = 'utf-8'

  Encoding (default utf-8).

##### Return values

mixed —

#### load()

DOMParser.php : 118

Parse HTML from URL.

`public static load(string $url) : static`

##### Parameters

$url : string

  URL to parse.

##### Return values

static —

#### nodes()

DOMParser.php : 129

Get all nodes.

`public nodes() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

#### toHTML()

DOMParser.php : 139

Export the parsed HTML code as a string.

`public toHTML() : string`

##### Return values

string —

#### drawNode()

DOMParser.php : 155

Draw the node and its descendants recursively.

`private drawNode(DOMNode $node) : string`

##### Parameters

$node : DOMNode

  The node to draw.

##### Return values

string —

The HTML representation of the node.

#### populate()

DOMParser.php : 191

Populate previousSibling and nextSibling for each node recursively.

`private populate(DOMNode $node) : mixed`

##### Parameters

$node : DOMNode

  The node to populate.

##### Return values

mixed —

## Search results