class DomQuery extends SimpleXMLElement

DomQuery simplifies querying (X)HTML documents.

Methods

static DomQuery
fromHtml(string $html)

Creates a DomQuery object from an HTML string.

static DomQuery
fromXml(string $xml)

Creates a DomQuery object from an XML string.

array
find(string $selector)

Finds descendants of current element that match the given CSS selector.

bool
has(string $selector)

Checks if any descendant of current element matches the given selector.

bool
matches(string $selector)

Determines if the current element matches the specified CSS selector.

static string
css2xpath(string $css)

Converts a CSS selector into an XPath expression.

Details

at line 21
static DomQuery fromHtml(string $html)

Creates a DomQuery object from an HTML string.

Parameters

string $html

Return Value

DomQuery

at line 57
static DomQuery fromXml(string $xml)

Creates a DomQuery object from an XML string.

Parameters

string $xml

Return Value

DomQuery

at line 67
array find(string $selector)

Finds descendants of current element that match the given CSS selector.

Parameters

string $selector

Return Value

array

at line 77
bool has(string $selector)

Checks if any descendant of current element matches the given selector.

Parameters

string $selector

Return Value

bool

at line 86
bool matches(string $selector)

Determines if the current element matches the specified CSS selector.

Parameters

string $selector

Return Value

bool

at line 95
static string css2xpath(string $css)

Converts a CSS selector into an XPath expression.

Parameters

string $css

Return Value

string