PHP Class Habari\HTMLDoc

Show file Open project: habari/system

Public Properties

Property Type Description
$dom DomDocument
$xp DOMXPath

Public Methods

Method Description
__construct ( string $html ) Create a HTMLDoc object
__toString ( ) : string Render this DOM as a string
create ( string $html ) : HTMLDoc Fluent constructor for HTMLDoc objects
find ( string $find ) : HTMLNodes Find elements in the DOM based on CSS selector
find_one ( string $find ) : HTMLNode Find the first element in the DOM based on a CSS selector
get ( ) : string Return the HTML represented by the DOM
query ( string $expression, DomNode $contextnode = null, boolean $registerNodeNS = true ) : HTMLNodes Pass a query on to the XPath query method

Method Details

__construct() public method

Create a HTMLDoc object
public __construct ( string $html )
$html string The HTML to parse

__toString() public method

Render this DOM as a string
public __toString ( ) : string
return string the string representation of the DOM

create() public static method

Fluent constructor for HTMLDoc objects
public static create ( string $html ) : HTMLDoc
$html string The HTML to parse
return HTMLDoc An instance of the HTMLDoc object created

find() public method

Find elements in the DOM based on CSS selector
public find ( string $find ) : HTMLNodes
$find string A CSS selector
return HTMLNodes A list of qualifying nodes

find_one() public method

Find the first element in the DOM based on a CSS selector
public find_one ( string $find ) : HTMLNode
$find string A CSS selector
return HTMLNode A qualifying node

get() public method

Return the HTML represented by the DOM
public get ( ) : string
return string The requested HTML

query() public method

Pass a query on to the XPath query method
public query ( string $expression, DomNode $contextnode = null, boolean $registerNodeNS = true ) : HTMLNodes
$expression string An XPath expression
$contextnode DomNode The context of the query, by default, the root node
$registerNodeNS boolean true by default, false to disable the automatic registration of the context node
return HTMLNodes A list of qualifying nodes

Property Details

$dom public property

public DomDocument $dom
return DomDocument

$xp public property

public DOMXPath $xp
return DOMXPath