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 24
static DomQuery
fromHtml(string $html)
Creates a DomQuery object from an HTML string.
at line 71
static DomQuery
fromXml(string $xml)
Creates a DomQuery object from an XML string.
at line 81
array
find(string $selector)
Returns array of elements matching CSS selector.
at line 99
bool
has(string $selector)
Checks if any descendant matches CSS selector.
at line 110
bool
matches(string $selector)
Checks if element matches CSS selector.
at line 121
DomQuery|null
closest(string $selector)
Returns closest ancestor matching CSS selector.
at line 134
static string
css2xpath(string $css)
Converts a CSS selector into an XPath expression.