承接 codealfa/css2xpath 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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 SelectorFactory or extend the existing one to inject into the Css2XpathConverter class.
  • 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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2024-09-30