Alexandre Alapetite ae54a590b9 Replace lib_phpQuery by PhpGt/CssXPath (#4261) 4 anni fa
..
CssXPathException.php ae54a590b9 Replace lib_phpQuery by PhpGt/CssXPath (#4261) 4 anni fa
LICENSE ae54a590b9 Replace lib_phpQuery by PhpGt/CssXPath (#4261) 4 anni fa
NotYetImplementedException.php ae54a590b9 Replace lib_phpQuery by PhpGt/CssXPath (#4261) 4 anni fa
README.md ae54a590b9 Replace lib_phpQuery by PhpGt/CssXPath (#4261) 4 anni fa
Translator.php ae54a590b9 Replace lib_phpQuery by PhpGt/CssXPath (#4261) 4 anni fa

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.


<img src="https://badge.status.php.gt/cssxpath-build.svg" alt="Build status" />

<img src="https://badge.status.php.gt/cssxpath-quality.svg" alt="Code quality" />

<img src="https://badge.status.php.gt/cssxpath-coverage.svg" alt="Code coverage" />

<img src="https://badge.status.php.gt/cssxpath-version.svg" alt="Current version" />

<img src="https://badge.status.php.gt/cssxpath-docs.svg" alt="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");