\Horde_Domhtml

Parse DOM data from HTML strings.

Summary

Methods
Properties
Constants
__construct()
getHead()
getBody()
returnHtml()
returnBody()
getCharset()
current()
key()
next()
rewind()
valid()
$dom
No constants found
_loadHTML()
$_iterator
$_origCharset
$_xmlencoding
N/A
No private methods found
No private properties found
N/A

Properties

$dom

$dom : \DOMDocument

DOM object.

Type

\DOMDocument

$_iterator

$_iterator : array

Iterator status.

Type

array

$_origCharset

$_origCharset : string

Original charset of data.

Type

string

$_xmlencoding

$_xmlencoding : string

Encoding tag added to beginning of output.

Type

string

Methods

__construct()

__construct(string  $text, string  $charset = null) 

Constructor.

Parameters

string $text

The text of the HTML document.

string $charset

The charset of the HTML document.

Throws

\Exception

getHead()

getHead() : \DOMElement

Returns the HEAD element, or creates one if it doesn't exist.

Returns

\DOMElement —

HEAD element.

getBody()

getBody() : \DOMElement

Returns the BODY element, or creates one if it doesn't exist.

Returns

\DOMElement —

BODY element.

returnHtml()

returnHtml(array  $opts = array()) : string

Returns the full HTML text in the original charset.

Parameters

array $opts

Additional options: (since 2.1.0)

  • charset: (string) Return using this charset. If set but empty, will return as currently stored in the DOM object.
  • metacharset: (boolean) If true, will add a META tag containing the charset information.

Returns

string —

HTML text.

returnBody()

returnBody() : string

Returns the body text in the original charset.

Returns

string —

HTML text.

getCharset()

getCharset() : string

Get the charset of the DOM data.

Returns

string —

Charset of DOM data.

current()

current() 

key()

key() 

next()

next() 

rewind()

rewind() 

valid()

valid() 

_loadHTML()

_loadHTML(string  $html) 

Loads the HTML data.

Parameters

string $html

HTML data.