A free, self-hostable aggregator…
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Alexandre Alapetite ae54a590b9
Replace lib_phpQuery by PhpGt/CssXPath (#4261)
3 years ago
..
CssXPathException.php Replace lib_phpQuery by PhpGt/CssXPath (#4261) 3 years ago
LICENSE Replace lib_phpQuery by PhpGt/CssXPath (#4261) 3 years ago
NotYetImplementedException.php Replace lib_phpQuery by PhpGt/CssXPath (#4261) 3 years ago
README.md Replace lib_phpQuery by PhpGt/CssXPath (#4261) 3 years ago
Translator.php Replace lib_phpQuery by PhpGt/CssXPath (#4261) 3 years ago

README.md

Translate CSS selectors to XPath queries.

A lightweight and dependency free CSS to XPath translator. This repository is used to bring modern DOM functionality like querySelectorAll() to PHP in the PHP.Gt/Dom project.


Build status Code quality Code coverage Current version PHP.Gt/CssXPath documentation

Example usage

use Gt\CssXPath\Translator;

$html = <<<HTML
<form>
	<label>
		Name
		<input name="name" />
	</label>
	<label>
		Code:
		<input name="code" />
	</label>
	<button name="do" value="submit">Submit code</button>
</form>
HTML;

$document = new DOMDocument();
$document->loadHTML($html);

$xpath = new DOMXPath($document);
$inputElementList = $xpath->query(new Translator("form>label>input");