DomQuery
class DomQuery extends SimpleXMLElement
Simplifies querying and traversing HTML documents using CSS selectors.
Methods
array
find(string $selector)
Returns array of elements matching CSS selector.
bool
has(string $selector)
Checks if any descendant matches CSS selector.
bool
matches(string $selector)
Checks if element matches CSS selector.
static string
css2xpath(string $css)
Converts a CSS selector into an XPath expression.
Details
at line 22
static DomQuery
fromHtml(string $html)
Creates a DomQuery object from an HTML string.
at line 69
static DomQuery
fromXml(string $xml)
Creates a DomQuery object from an XML string.
at line 79
array
find(string $selector)
Returns array of elements matching CSS selector.
at line 97
bool
has(string $selector)
Checks if any descendant matches CSS selector.
at line 108
bool
matches(string $selector)
Checks if element matches CSS selector.
at line 119
DomQuery|null
closest(string $selector)
Returns closest ancestor matching CSS selector.
at line 132
static string
css2xpath(string $css)
Converts a CSS selector into an XPath expression.