codealfa/css2xpath
最新稳定版本:1.0
Composer 安装命令:
composer require codealfa/css2xpath
包简介
CSS to XPath Converter
README 文档
README
Installation
Run the following command to use the library in your projects.
composer require codealfa/css2xpath
Basic Usage
use CodeAlfa\Css2Xpath\Css2XpathConverter; use CodeAlfa\Css2Xpath\SelectorFactory; $converter = new Css2XpathConverter(new SelectorFactory()); $xPath = $converter->convert('p#main, div.container'); var_dump($xPath);
Output:
p[@id="main"]|div[@class and contains(concat(" ", normalize-space(@class), " "), " container ")]
Notes
- The Selector classes are extendable if you need to add or change functionality. You'll just need to create your own
SelectorFactoryor extend the existing one to inject into theCss2XpathConverterclass. - Some CSS pseudo-selectors only make sense in the context of a web browser, so only the following pseudo-selectors are
implemented. All others are ignored:
- :enabled
- :disabled
- :read-only
- :read-write
- :checked
- :required
- :root
- :empty
- :first-child
- :last-child
- :only-child
- :first-of-type
- :last-of-type
- :only-of-type
- :not
- :has
License
GPL-3.0 or later
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2024-09-30