Symfony2 API
Class

Symfony\Component\CssSelector\CssSelector

class CssSelector

CssSelector is the main entry point of the component and can convert CSS selectors to XPath expressions.

$xpath = CssSelector::toXpath('h1.foo');

This component is a port of the Python cssselector library,
which is copyright Ian Bicking, see https://github.com/SimonSapin/cssselect.

Methods

static string toXPath(mixed $cssExpr, string $prefix = 'descendant-or-self::')

Translates a CSS expression to its XPath equivalent.

static  enableHtmlExtension()

Enables the HTML extension.

static  disableHtmlExtension()

Disables the HTML extension.

Details

at line 50
static public string toXPath(mixed $cssExpr, string $prefix = 'descendant-or-self::')

Translates a CSS expression to its XPath equivalent.

Optionally, a prefix can be added to the resulting XPath
expression with the $prefix parameter.

Parameters

mixed $cssExpr The CSS expression.
string $prefix An optional prefix for the XPath expression.

Return Value

string

at line 71
static public enableHtmlExtension()

Enables the HTML extension.

at line 79
static public disableHtmlExtension()

Disables the HTML extension.